nexus:
image: sonatype/nexus3
ports:
- "8082:8081"
# 开放docker私服的端口,这个端口可以随意配置
- "8084:8080"
volumes:
- "/home/docker/nexus:/nexus-data"
deploy:
placement:
constraints: [node.role == manager]
networks:
- webnet
docker stack deploy -c docker-compose.yml hmp_dev
注意:nexus的默认账号密码是admin/admin123, 部署好后请及时修改
这个地方有三种仓库类型:
下面我们将创建三种不同的仓库,并进行一些配置为本地开发提供镜像的发布与下载支持。
注:图中使用镜像地址是http://f1361db2.m.daocloud.io,这个地方填入的地址其实就是国内的中央仓库加速地址,也是一个代理仓库。
到目前为止,nexus中的配置就已经完成了。
注意:私服地址为:http://192.168.0.40:8084
# 直接拉取镜像
root@ubuntu:~# docker pull 192.168.0.40:8084/httpd
Using default tag: latest
Error response from daemon: Get https://192.168.0.40:8084/v2/: http: server gave HTTP response to HTTPS client
# 这个时候会报错,所以需要在docker的信任仓库中配置私服
root@ubuntu:~# vi /etc/docker/daemon.json
# 该文件可能是新建也可能是更新,在文件中添加以下内容
{
"insecure-registries":["192.168.0.40:8084"]
}
# 重启docker
root@ubuntu:~# systemctl daemon-reload
root@ubuntu:~# systemctl restart docker
# 重新拉取镜像
root@ubuntu:~# docker pull 192.168.0.40:8084/httpd
Using default tag: latest
Error response from daemon: Get http://192.168.0.40:8084/v2/httpd/manifests/latest: no basic auth credentials
# 这个时候的错误说明还需要登录
root@ubuntu:~# docker login 192.168.0.40:8084
Username: admin
Password:
Login Succeeded
# 重新拉取镜像
root@ubuntu:~# docker pull 192.168.0.40:8084/httpd
Using default tag: latest
latest: Pulling from httpd
5e6ec7f28fb7: Pull complete
566e675a8212: Pull complete
ef5a8026039b: Pull complete
22ecb0106557: Pull complete
91cc511c603e: Pull complete
Digest: sha256:f3d37ac44680fdb30939790e82fb32745be6d1173b6df4fec5087729b5497ed5
Status: Downloaded newer image for 192.168.0.40:8084/httpd:latest
全部评论