1.拉取镜像
docker pull sonatype/nexus3
2.启动容器
sudo docker run -d --name nexus3 --restart=always -p 8088:8088 -p 8081:8081 -p 5000:5000 -v /mnt/gv0/nexus-data:/nexus-data sonatype/nexus3
3.修改maven settings.xml 这里使用默认用户名 admin 密码 admin123
H:\localRepository nexus admin admin123 maven-public admin admin123 maven-releases admin admin123 maven-snapshots admin admin123 3rd-part admin admin123 maven-central admin admin123 maven-public public central http://192.168.91.137:8081/repository/maven-public/ maven-releases releases central http://192.168.91.137:8081/repository/maven-releases/ maven-snapshots snapshots central http://192.168.91.137:8081/repository/maven-snapshots/ 3rd-part 3rd-part central http://192.168.91.137:8081/repository/3rd-part/ maven-central maven-central central http://192.168.91.137:8081/repository/maven-central/ nexus nexus http://192.168.91.137:8081/repository/maven-public/ true always true always nexus http://192.168.91.137:8081/repository/maven-public/ true always true always nexus
4.如果项目需要发布到nexus,修改pom 添加以下 distributionManagement 内容
4.0.0 org.lzw idworker 1.0-SNAPSHOT maven-releases maven-releases http://192.168.91.137:8081/repository/maven-releases/ maven-snapshots maven-snapshots http://192.168.91.137:8081/repository/maven-snapshots/
5.发布
登录进入 http://192.168.91.137:8081 页面查看 默认用户名 admin 密码 admin123