解决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)

拉取报错

[root@localhost ~]# docker pull zookeeper
Using default tag: latest
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)

解决方法

编写配置文件

将可用的镜像仓库地址写入到 daemon.json 配置文件中(目前2024年10月08日可用的源)

[root@localhost ~]# vim /etc/docker/daemon.json
[root@localhost ~]# more /etc/docker/daemon.json
{
    "registry-mirrors": [
    "https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
    "https://docker.m.daocloud.io",
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com",
    "https://your_preferred_mirror",
    "https://dockerhub.icu",
    "https://docker.registry.cyou",
    "https://docker-cf.registry.cyou",
    "https://dockercf.jsdelivr.fyi",
    "https://docker.jsdelivr.fyi",
    "https://dockertest.jsdelivr.fyi",
    "https://mirror.aliyuncs.com",
    "https://dockerproxy.com",
    "https://mirror.baidubce.com",
    "https://docker.m.daocloud.io",
    "https://docker.nju.edu.cn",
    "https://docker.mirrors.sjtug.sjtu.edu.cn",
    "https://docker.mirrors.ustc.edu.cn",
    "https://mirror.iscas.ac.cn",
    "https://docker.rainbond.cc"
    ]
}
[root@localhost ~]#

重新加载一下docker的配置文件

[root@localhost ~]# systemctl daemon-reload

重启一下docker服务

[root@localhost ~]# systemctl restart docker.service

拉一下镜像

[root@localhost ~]# docker pull zookeeper

posted @ 2024-10-08 10:32  谢墨尘  阅读(7224)  评论(8编辑  收藏  举报