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).

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).

一、问题:

docker: 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).
二、描述

在使用docker进行镜像拉取的时候,存在拉取不下来,或者超市的问题,就会报
docker: Error response from daemon: Get “https://registry-1.docker.io/v2/“: net/http: request canc的错误,导致无法开心的使用docker。
三、解决

具体解决方法如下:

1.备份原来的配置文件

cp /etc/docker/daemon.json{,.bak}

2.删除或修改daemon.json 文件,我这里因为是测试环境就直接删除原来的配置文件了,并添加如下配置

rm -rf /etc/docker/daemon.json

sudo tee /etc/docker/daemon.json <<-‘EOF’

{
“registry-mirrors”: [
“https://docker.1ms.run”,
“https://docker.1panel.live/”
]
}
EOF

3.重新加载配置文件和重启docker

sudo systemctl daemon-reload
sudo systemctl restart docker