docker 错误 request canceled while waiting for connection 或 TLS handshake timeout 解决方案

不念不忘少年蓝@ 2021-08-19 12:52 895阅读 0赞

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

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

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

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

  1. vi /etc/docker/daemon.json

在文件中加入:

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

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

然后重启进程:

  1. service docker restsart

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

  1. docker pull daocloud.io/library/centos:7

发表评论

表情:
评论列表 (有 0 条评论,895人围观)

还没有评论,来说两句吧...

相关阅读