前言
在离线手动部署docker镜像仓库——harbor仓库(一)和离线手动部署docker镜像仓库——harbor仓库(二)的实验中,遇到一些harbor仓库部署的问题,在此做个小结。
实验环境:
harbor服务器系统:CentOS Linux release 7.4.1708 (Core)
harbor服务器IP:10.0.0.101(test101)
harbor版本:v1.5.0
docker版本:1.13.1
使用了另一台机器做pull和push镜像测试:10.0.0.102(test102)
问题集锦
1、docker配置文件没生效,引起的push镜像失败,报错10.0.0.101:443: getsockopt: connection refused
问题描述:
在test101机器刚刚部署好harbor的时候,push镜像失败了,报“Get https://10.0.0.101/v1/_ping: dial tcp 10.0.0.101:443: getsockopt: connection refused”
[root@test101 nginx]# docker push 10.0.0.101/test/bigdatacenter:latest
The push refers to a repository [10.0.0.101/test/bigdatacenter]
Get https://10.0.0.101/v1/_ping: dial tcp 10.0.0.101:443: getsockopt: connection refused
[root@test101 nginx]#
原因分析:
是因为配置文件里面配置的--insecure-registry=10.0.0.101这一行配置没有生效(修改了配置之后,有重启docker,但是这行内容也没有加载成功):
解决方法:
再次重新启动了docker服务,使之重新加载配置文件
[root@test101 harbor]# systemctl daemon-reload #重启docker之前,先执行了这个步骤,很重要
[root@test101harbor]# systemctl restart docker
然后测试登录harbor仓库,就OK了:
[root@test101 harbor]# docker login 10.0.0.101
Username: admin
Password:
Login Succeeded
再push镜像就成功了:
[root@test101 harbor]# docker push 10.0.0.101/test/bigdatacenter:latest
The push refers to a repository [10.0.0.101/test/bigdatacenter]
df9d7f53cb5b: Pushed
ab0926f7e