1.查找鏡像
docker search nexus
2.拉取鏡像
docker pull sonatype/nexus3
3.啟動容器
docker run -d -p 8081:8081 -p 8082:8082 -p 8083:8083 -v /etc/localtime:/etc/localtime --name nexus3 sonatype/nexus3
# -v /home/nexus/nexus-data:/nexus-data 將數據掛載到宿主機
## 8081:nexus3網頁端
## 8082:docker(hosted)私有倉庫,可以pull和push(后面實現docker的時候會詳細說明)
## 8083:docker(proxy)代理遠程倉庫,只能pull(后面實現docker的時候會詳細說明)
查看日志
docker logs nexus3
4.開放端口
firewall-cmd --zone=public --permanent --add-port=8081/tcp
firewall-cmd --zone=public --permanent --add-port=8082/tcp
firewall-cmd --zone=public --permanent --add-port=8083/tcp
重新啟動防火牆
systemctl restart firewalld
5.訪問
點擊右上角登錄 賬號密碼:admin/admin123
6.開機啟動
docker update --restart=always nexus3