【docker】centos7 上拉取docker镜像,一直拉取不到,报错:Error response from daemon: Get https://registry-1.docker.io/...

镜像拉取一直报错:

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)

解决方法:

1.创建daemon.json文件

vi /etc/docker/daemon.json

2.在文件内容加入:

{
    "registry-mirrors": ["http://f1361db2.m.daocloud.io"]
}

3.重启docker

systemctl daemon-reload
systemctl restart docker

4.执行下面的命令

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有细微不同。

5.重启docker服务

service docker restart

即可成功拉取docker镜像了,如下图:

转载于:https://www.cnblogs.com/sxdcgaq8080/p/11059976.html

猜你喜欢

转载自blog.csdn.net/weixin_33851604/article/details/93385664