k8s登录harbor报错:Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request cance

[root@k8s-node02 ~]# docker login 192.168.180.105:1180
Username: admin
Password:
Error response from daemon: Get http://192.168.180.105:1180/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

解决方案:
1.打开终端,su root 输入密码
2.打开 vim /etc/docker/daemon.json(若没有自行创建)
3.写入:

[root@k8s-node02 ~]# cat /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},"insecure-registries":[
    "192.168.180.105:1180"
  ]
}
[root@k8s-node02 ~]#
"insecure-registries":[
"192.168.180.105:1180"
]

4.重启一下docker:

[root@topcheer ~]# systemctl daemon-reload  #加载配置文件
[root@topcheer ~]# systemctl restart docker  #重启
[root@topcheer ~]#

成功解决

[root@k8s-node02 ~]# docker login 192.168.180.105:1180
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
[root@k8s-node02 ~]# curl  http://192.168.180.105:1180
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
posted @ 2021-08-09 21:56  flytoyou  阅读(2716)  评论(0编辑  收藏  举报