目录
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