故障:Error response from daemon: Get https://20.0.0.10/v2/: dial tcp 20.0.0.10:443: connect: connection refused
其他服务端登录Harbor私有仓库错误提示信息:
1 [root@server2 ~]# docker login -u admin -p Harbor12345 http://20.0.0.10
2 WARNING! Using --password via the CLI is insecure. Use --password-stdin.
3 Error response from daemon: Get https://20.0.0.10/v2/: dial tcp 20.0.0.10:443: connect: connection refused
原因分析:
以上操作都是在 Harbor 服务器本地操作。如果其他客户端上传镜像到 Harbor,就会报如下错误。出现这问题的原因 Docker Registry 交互默认使用的是 HTTPS,但是搭建私有镜像默认使用的是 HTTP 服务,所以与私有镜像交互时出现以下错误。
解决方法:
1 再docker系统服务添加安全进程
2 [root@server1 ~]# vim /usr/lib/systemd/system/docker.service
3 #14行
4 ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry 20.0.0.10 --containerd=/run/container d/containerd.sock #中间添加--insecure-registry 20.0.0.10
5
6 重新加载守护进程并重启
7 [root@server1 ~]# systemctl daemon-reload
8 [root@server1 ~]# systemctl restart docker
9
10 server1上重新加载脚本
11 [root@server1 ~]# cd /usr/local/harbor
12 [root@server1 ~]# ./install.sh
13
14 登录
15 [root@server1 ~]# docker login -u admin -p Harbor12345 http://20.0.0.10
16 WARNING! Using --password via the CLI is insecure. Use --password-stdin.
17 WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
18 Configure a credential helper to remove this warning. See
19 https://docs.docker.com/engine/reference/commandline/login/#credentials-store
20
21 Login Succeeded #登录成功