docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled

sudo docker run hello-world
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).
See ‘docker run –help’.
Modify docker image source:
The default source of Docker is foreign official source, the download speed is slow, can be changed to domestic, speed up
Plan a
Modify or add /etc/docker/daemon.json
# vi /etc/docker/daemon.json
{
“registry-mirrors”: [“http://hub-mirror.c.163.com”]
}
systemctl restart docker.service
Scheme 2
Modified or new/etc/sysconfig/docker, additional parameters after the OPTIONS variable – registry-mirror=https://docker.mirrors.ustc.edu.cn
# vi /etc/sysconfig/docker
OPTIONS=’–selinux-enabled –log-driver=journald –registry-mirror=https://docker.mirrors.ustc.edu.cn’
Domestic source description of Docker:
Docker official China
https://registry.docker-cn.com
netease
http://hub-mirror.c.163.com
University of Science and Technology of China
https://docker.mirrors.ustc.edu.cn
Ali cloud
https://pee6w651.mirror.aliyuncs.com
Finally, I solved the problem with the following solution:
Into the/etc/docker
Check for daemon.JSON. This is the default configuration file for Docker.
If it is not new, if it is, change it.
Json
[root@zengmg docker]# vi daemon. Json
{
“registry-mirrors”: [“https://registry.docker-cn.com”,”http://hub-mirror.c.163.com”]
}
Save exit.

restart the docker service
service docker restart
Success!
 

Read More: