- 查找镜像
docker search nexus
2. 拉取最新版本
docker pull sonatype/nexus3
- 持久化目录
mkdir -p /data/nexus/data
chmod 777 -R /data/nexus/data
- 启动镜像
docker run -d --name nexus3 --privileged=true -p 9081:8081 -p 9082:8082 -p 9083:8083 --restart always -v /data/nexus/data:/nexus-data sonatype/nexus3
5.开放端口
firewall-cmd --zone=public --permanent --add-port=9081/tcp
firewall-cmd --zone=public --permanent --add-port=9082/tcp
firewall-cmd --zone=public --permanent --add-port=9083/tcp
#重新启动防火墙 systemctl restart firewalld
- 查看日志 Started Sonatype Nexus OSS 表示启动好了
docker logs -f nexus3
- 访问nexus,ip:9081,查看管理员
7.添加阿里云
- 点击
settings->Repository->Repositories - 选择maven2 (proxy)
- 填写如下两个字段,分别是代理库的名称,所代理的上层库的url。阿里云url为:
http://maven.aliyun.com/nexus/content/groups/public/
4. 滚动到页面最下方,点击“Create repositoty”按钮。
5. 重新配置maven-public组,使其包含新建的aliyun-maven
8.配置maven
(1)配置settings.xml 设置全局
(2)增加mirrors