Error response from daemon: Get https://harbor.od.com/v2/: dial tcp 10.4.7.200:443: connect: connect

创建私有镜像仓库后远程的主机登录不上去保报错如下
[root@hdss7-22 ~]# docker login harbor.od.com
Username: admin
Password:
Error response from daemon: Get https://harbor.od.com/v2/: dial tcp 10.4.7.200:443: connect: connection refused
然而我是在200上创建的私有仓库,通过映射的端口为180—》80
[root@hdss7-200 etc]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
da727c91a66b goharbor/nginx-photon:v1.8.3 “nginx -g 'daemon of…” 2 weeks ago Up 41 minutes (healthy) 0.0.0.0:180->80/tcp, :::180->80/tcp nginx
cfcf2c32e7ca goharbor/harbor-portal:v1.8.3 “nginx -g 'daemon of…” 2 weeks ago Up 41 minutes (healthy) 80/tcp harbor-portal
9e245dc986b2 goharbor/harbor-jobservice:v1.8.3 “/harbor/start.sh” 2 weeks ago Up 40 minutes harbor-jobservice
a0d2ce70be98 goharbor/harbor-core:v1.8.3 “/harbor/start.sh” 2 weeks ago Up 40 minutes (healthy) harbor-core

解决办法::
第一种
在21上修改配置文件
[root@hdss7-21 ~]# vim /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd --insecure-registry 10.4.7.200:180 -H fd:// --containerd=/run/containerd/containerd.sock ##添加ip地址和端口以及前面的内容
这个时候重启docker可以会报错如下
[root@hdss7-21 ~]# systemctl restart docker
Job for docker.service failed because start of the service was attempted too often. See “systemctl status docker.service” and “journalctl -xe” for details.
To force a start use “systemctl reset-failed docker.service” followed by “systemctl start docker.service” again.
这个时候不要惊慌 ,先去查看文件/etc/docker/daemon.json 将部分内容有原来的地方注释掉或放在放在括号下面
{
“graph”: “/data/docker”,
“storage-driver”: “overlay2”,
“registry-mirrors”: [“https://7lkjwk2y.mirror.aliyuncs.com”],
“bip”: “172.7.21.1/24”,
“exec-opts”: [“native.cgroupdriver=systemd”],
“live-restore”: true
}
#“insecure-registries”: [“registry.access.redhat.com”,“quay.io”,“hardor.od.com”,“10.4.7.200:80”],
上面是需要注释的一句,这个时候再去重启docker就能启动了,但是登陆的时候要这么登陆
[root@hdss7-21 ~]# docker login 10.4.7.200:180
Authenticating with existing credentials…
Login did not succeed, error: Error response from daemon: Get http://10.4.7.200:180/v2/: Get http://harbor.od.com:180/service/token?account=admin&client_id=docker&offline_token=true&service=harbor-registry: dial tcp: lookup harbor.od.com on 8.8.8.8:53: no such host
Username (admin): admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

或者想用harbor.od.com域名进行登录可以进行下面的操作
[root@hdss7-21 ~]# vim /usr/lib/systemd/system/docker.service
#ExecStart=/usr/bin/dockerd --insecure-registry 10.4.7.200:180 -H fd:// --containerd=/run/containerd/containerd.sock ##注释掉
ExecStart=/usr/bin/dockerd --insecure-registry harbor.od.com -H fd:// --containerd=/run/containerd/containerd.sock ##新增
然后
[root@hdss7-21 ~]# systemctl daemon-reload
[root@hdss7-21 ~]# systemctl restart docker
[root@hdss7-21 ~]# docker login harbor.od.com
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

方法二
不用去修改docker的配置的问津直接修改下面的文件就可以了
[root@hdss7-22 ~]# vi /etc/docker/daemon.json
{
“graph”: “/data/docker”,
“storage-driver”: “overlay2”,
“insecure-registries”: [“registry.access.redhat.com”,“quay.io”,“hardor.od.com”,“10.4.7.200:180”],
“registry-mirrors”: [“https://7lkjwk2y.mirror.aliyuncs.com”],
“bip”: “172.7.22.1/24”,
“exec-opts”: [“native.cgroupdriver=systemd”],
“live-restore”: true
}
新增10.4.7.200:180然后重启docker后就能用下面的方式登陆了
[root@hdss7-22 ~]# docker login 10.4.7.200:180
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值