xiayu 发表于 2019-2-22 07:55:02

docker里部署nexus3

安装方式:

[*]  直接使用docker拉取官方镜像
[*]  源码安装
[*]  dockerfile构建
以上使用第一种方式安装,简单快捷,直接拉取镜像然后启动即可。
系统环境:
系统: Ubuntu 16.04
内核: 4.4.0-116-generic
安装步骤:
安装docker:
$ sudo apt-get update$ sudo apt-get install docker-ce启动 Docker CE:
$ sudo service docker start或者
$ sudo /etc/init.d/docker start查找镜像:
$ docker search nexus3拉取镜像(这里使用官方镜像,基于centos):
$ docker pull sonatype/nexus3启动:
$ docker run -d -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 8084:8084 --name nexus3 sonatype/nexus3 -v /opt/nexus-data:/nexus-data映射的4个端口用途:

[*]8081:nexus3网页端
[*]8082:docker(hosted)私有仓库,可以pull和push
[*]8083:docker(proxy)代理远程仓库,只能pull
[*]8084:docker(group)私有仓库和代理的组,只能pull
/nexus-data:docker里存nexus数据目录,所以将数据目录存放到宿主机/opt/nexus-data
访问网页端
http://192.168.2.210:8081#默认账号密码: admin/admin123http://wiki.go2office.org:8200/download/attachments/9011220/0.png?version=1&modificationDate=1522137720660&api=v2
配置docker(hosted)

[*]登录
[*]设置私有仓库--> Repositories --> Create repository --> docker(hosted)这里使用的是http
http://wiki.go2office.org:8200/download/attachments/9011220/1.png?version=4&modificationDate=1522137656000&api=v2
http://wiki.go2office.org:8200/download/attachments/9011220/5.png?version=1&modificationDate=1522137964987&api=v2
私有仓库push/pull测试(回到宿主机下)
$ docker login 192.168.2.210:8082 #admin/admin123$ docker tag 2d194b392dd1 192.168.2.210:8082/centos7
$ docker push 192.168.2.210:8082/centos7查看仓库:
http://wiki.go2office.org:8200/download/attachments/9011220/2.png?version=1&modificationDate=1522138244154&api=v2
拉取:
$ docker rmi 192.168.2.210:8082/centos7 #先删除本地镜像再拉取$ docker pull 192.168.2.210:8082/centos7配置docker(proxy)

[*]  Name --> mydocker-proxy
[*]  HTTP Port --> 8083
[*]  Enable Docker V1 API
[*]  Remote storage --> https://registry-1.docker.io
[*]  Docker Index:

[*]  Use Docker Hub

http://wiki.go2office.org:8200/download/attachments/9011220/3.png?version=1&modificationDate=1522139249050&api=v2
http://wiki.go2office.org:8200/download/attachments/9011220/4.png?version=1&modificationDate=1522139328339&api=v2
宿主机登录测试
$ docker login 192.168.2.210:8083 #admin/admin123
$ docker search 192.168.2.210:8083/hello-world

http://wiki.go2office.org:8200/download/attachments/9011220/8.png?version=1&modificationDate=1522139583658&api=v2

$ docker pull 192.168.2.210:8083/hello-worldhttp://wiki.go2office.org:8200/download/attachments/9011220/7.png?version=1&modificationDate=1522139470435&api=v2
官方文档
git



页: [1]
查看完整版本: docker里部署nexus3