Nexus Docker 部署

Pull the image

docker pull docker.io/sonatype/nexus3

准备持久化数据存储路径

  • 必须保证磁盘空间至少4GB
mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data

Start up Nexus3

  • Make sure 2GB memory at least. The container will consume more then 1.2GB memory
  • 2-3 mins is needed to initialise everything.
docker run -d --name nexus3 -p 8081:8081 -p 8082:8082 -p 8083:8083 -v /some/dir/nexus-data:/nexus-data --restart=on-failure:3 sonatype/nexus3
  • 8081 端口映射用于Maven仓库访问
  • 8082、8083 预留用于其他仓库的访问 e.g. docker仓库
  • restart=on-failure:3 表示容器退出时,若容器的退出状态非0,则docker自动重启容器,若超过指定次数未能启动容器则放弃

可使用logs命令查看容器运行日志:

docker logs [-f] nexus3

访问 Nexus3

  • Fire up your favorate web browser.
  • Visit http://Your-IP:8081
  • Copy temp passwd for admin from your server /some/dir/nexus-data/admin.password
  • Sign in Nexus with User: admin
  • Follow the set up wizard to complete Nexus setting.