在进行docker pull 拉取镜像时,出现过下面的错误:
net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
原因是国内下载官方镜像点提供的镜像时,速度缓慢,超时。使用加速器就可以解决这个问题。
笔者使用的是Centos7,首先需要创建配置文件daemon.json
vim /etc/docker/daemon.json

https://blog.csdn.net/qappleh/article/details/99880102
在引文中描述中存在两点问题:
1、只添加https://docker.mirrors.ustc.edu.cn 一个镜像地址,在笔者的运行环境下报错,在执行 docker search centos命令后出现报错:
Error response from daemon: Get https://index.docker.io/v1/search?q=centos&n=25: net/http: TLS handshake timeout;
2、“registry-mirrors”:[“https://docker.mirrors.ustc.edu.cn”] 配置信息中双引号格式错误导致执行 systemctl restart docker 命令报错:
Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.
根据报错提示继续执行 systemctl status docker.service 出现如下报错信息:
解决Client.Timeout exceeded while awaiting headers报错
分析错误提示可知置信息中双引号格式有误

于是,笔者在文件中写入如下配置信息:
{
“registry-mirrors”:[“https://docker.mirrors.ustc.edu.cn”,“https://hub-mirror.c.163.com”,“http://f1361db2.m.daocloud.io”]
}

然后重启进程:
systemctl daemon-reload
systemctl restart docker

重新拉取镜像,问题解决!

相关文章:

  • 2022-12-23
  • 2021-05-09
  • 2021-11-06
  • 2022-12-23
  • 2023-03-16
  • 2021-09-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
相关资源
相似解决方案