目录
1.拉取nexus3镜像
# docker pull sonatype/nexus3
[root@iZ2zeejocu3f80bljfr5fdZ ~]# docker pull sonatype/nexus3
Using default tag: latest
latest: Pulling from sonatype/nexus3
262268b65bd5: Downloading 2.15MB/83.37MB
06038631a24a: Download complete
50539d8bb585: Download complete
c85fea177c04: Waiting
6f4fa3a69090: Waiting
2.查看镜像
# docker images
[root@iZ2zeejocu3f80bljfr5fdZ ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sonatype/nexus3 latest 8e82bd6e4710 40 hours ago 656MB
3.创建/data/nexus3目录并授权
# mkdir -p /data/nexus3
# chown -R 777 /data/nexus3
[root@iZ2zeejocu3f80bljfr5fdZ ~]# mkdir -p /data/nexus3
[root@iZ2zeejocu3f80bljfr5fdZ ~]# chown -R 777 /data/nexus3
4.根据镜像生成容器
# docker run -itd -p 8081:8081 --name nexus -v /data/nexus3/:/nexus-data sonatype/nexus3
[root@iZ2zeejocu3f80bljfr5fdZ ~]# docker run -itd -p 8081:8081 --name nexus -v /data/nexus3/:/nexus-data sonatype/nexus3
2c5a4783c39430e0e7bf3d4e722b7087367c245a9c2bd5babb98d841dcbfff3e
5 查看日志看容器是否正常启动
# docker logs -f nexus
6.在浏览器输入地址访问

注默认密码是admin,默认密码在容器中/nexus-data/admin.passsword
这里是将nexus中的文件挂载到了宿主机中,详细请看Docker Hub
本文详细介绍了如何通过Docker拉取Sonatype Nexus 3镜像,查看镜像状态,创建数据目录并授权,创建容器,监控日志以确保启动,以及最终在浏览器中访问Nexus 3。重点步骤包括设置镜像权限和容器网络配置。
3074

被折叠的 条评论
为什么被折叠?



