docker pull 报错。Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

使用魔法:

[root@rancher docker]# docker pull rancher/rancher:v2.7.5
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

emmm魔法

sudo mkdir -p /etc/systemd/system/docker.service.d
sudo cat >/etc/systemd/system/docker.service.d/http-proxy.conf << EOF
Environment="HTTP_PROXY=http://proxy.example.com:8080/"
Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
EOF

这里使用的是自己的clash for windows .

http://proxy.example.com

使用本地的ip地址。默认端口使用的7890

可以自行更改

注意这里的proxy-ip地址使用的是自己所联网的ip地址那张网卡联网就用那个ip.

[root@rancher docker.service.d]# systemctl daemon-reload
[root@rancher docker.service.d]# systemctl restart docker

[root@rancher docker.service.d]# docker pull rancher/rancher:v2.7.5
v2.7.5: Pulling from rancher/rancher
25db2d1fe29e: Pull complete 
865ffb362b40: Pull complete 
5b5134f7d794: Pull complete 
84ab582bce7e: Pull complete 
7878869d3a01: Pull complete 
7a993ec87c0f: Pull complete 
0a2fa8affd97: Pull complete 
8775dee5969b: Pull complete 
91fec06047de: Pull complete 
6b6c2e73e8e3: Pull complete 
fd97ba8511dd: Pull complete 
4f09e1aeb6b8: Pull complete 
5e9278cdae67: Pull complete 
4a4134a1a2ff: Pull complete 
76642f1df511: Pull complete 
b31afa519ee6: Pull complete 
534ed6dca93d: Pull complete 
c6e69a0b6980: Pull complete 
68a2e3b859f0: Pull complete 
ea2979d1e156: Pull complete 
Digest: sha256:5ba20e4e51a484f107f3f270fa52c5e609cad0692dd00a26169cc3541b1f3788
Status: Downloaded newer image for rancher/rancher:v2.7.5

OK

文章作者: emporer
本文链接:
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Emporer-Linux
docker kubernetes
喜欢就支持一下吧