使用docker 拉镜像的时候,出现下面的错误:

net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
或
net/http: TLS handshake timeout
或
request canceled (Client.Timeout exceeded while awaiting headers)

因为在下载官方镜像点的镜像国内访问速度太慢,所以报错,使用加速器就可以解决这个问题

首先打开配置文件daemon.json,centos上安装后有此文件,但是ubuntu上需要自己创建文件:

vi /etc/docker/daemon.json

在文件中加入:

{
    "registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}

其中镜像源可参考 《docker 设置国内镜像源》 https://blog.csdn.net/whatday/article/details/86770609

然后重启进程:

service docker restsart

如果还是不行,直接下载其他源地址,比如 下载centos7镜像 使用 https://hub.daocloud.io/ 镜像站

docker pull daocloud.io/library/centos:7

 

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐