常见问题现象

  1. 在使用 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)

  2. 在使用 Docker 时遇到拉取镜像速度慢的问题

出现以上问题可以使用国内的镜像源可以提高下载速度。

使用阿里镜像加速器

Docker 配置文件位于 /etc/docker/daemon.json。如果文件不存在,可以手动创建它。将以下内容添加到配置文件中:

整体复制执行命令:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://[系统分配前缀].mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

根据以下方法获取其中的 [系统分配前缀]

获取阿里云系统分配前缀

阿里云官方文档:
https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images
在这里插入图片描述
登录阿里云查询拥有的镜像加速器地址:
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
在这里插入图片描述

其他Docker镜像源

镜像源地址
Docker中国区官方https://registry.docker-cn.com
网易http://hub-mirror.c.163.com
中科大http://mirrors.ustc.edu.cn/
清华大学https://mirrors.tuna.tsinghua.edu.cn/
搜狐http://mirrors.sohu.com/
Logo

一起探索未来云端世界的核心,云原生技术专区带您领略创新、高效和可扩展的云计算解决方案,引领您在数字化时代的成功之路。

更多推荐