Docker login Harbor报错解决:Error response from daemon: Get https://.. 443: connect: connection refused

报错信息:
[root@localhost harbor]# docker login 172.16.2.15
Username: admin
Password: 
Error response from daemon: Get https://172.16.2.15/v2/: 
dial tcp 172.16.2.15:443: connect: connection refused
查看Docker版本:
[root@localhost ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:25:42 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

停止harbor:
 docker-compose down -v:停止并移除整个project的所有services

[root@localhost harbor]# docker-compose down -v
Stopping harbor-jobservice … done
Stopping nginx … done
Stopping harbor-ui … done
Stopping redis … done

查找docker.service所在位置:
[root@localhost harbor]# find / -name docker.service -type f
/usr/lib/systemd/system/docker.service

修改docker.service配置文件:
 添加 --insecure-registry=172.16.2.15  配置


[root@localhost harbor]# vim /usr/lib/systemd/system/docker.service
[Unit]
Documentation=http://docs.docker.io     //需修改
...
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry=172.16.2.15  //需修改
ExecStartPost=/sbin/iptables -I FORWARD -s 0.0.0.0/0 -j ACCEPT   //需修改,根据自己的docker路径跟IP地址进行修改
      
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
...
[Install]
WantedBy=multi-user.target
重启服务:
[root@localhost harbor]# systemctl daemon-reload

[root@localhost harbor]# systemctl restart docker

启动harbor:
 docker-compose up -d :构建(容器)并启动(容器)整个project的所有service

[root@localhost harbor]# docker-compose up -d
Creating network “harbor_harbor” with the default driver
Creating harbor-log … done
Creating registry … done
Creating redis … done
Creating harbor-db … done
Creating harbor-adminserver … done
Creating harbor-ui … done
Creating nginx … done
Creating harbor-jobservice … done

查看服务:
 已经包含了 --insecure-registry=172.16.2.15 参数

[root@localhost harbor]# ps -aux | grep docker

root 40719 1.4 4.8 660304 79992 ? Ssl 01:58 0:14 /usr/bin/dockerd --insecure-registry=172.16.2.15

测试登录:
[root@localhost harbor]# docker login 172.16.2.15
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 //登录成功

成功登录!

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值