Docker pull 时报错:Get https://registry-1.docker.io/v2/library/mysql: net/http: TLS handshake timeout


本文由 简悦 SimpRead 转码, 原文地址 blog.csdn.net

今天用 docker pull 镜像时提示以下错误

invalid image (图片无法加载)

Trying to pull repository docker.io/library/mysql ... 
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting heade
rs)

错误原因docker 默认镜像源为国外镜像源,下载速度过慢导致连接失败

解决办法更换国内镜像源

以 SmarTTy 客户端为操作示例:
点击左上角 file/open a remote file,寻找 etc/docker/daemon.json 文件并打开,其他客户端操作也类似,只要找到 daemon.json 文件即可,没有该文件则在以上路径自行创建

invalid image (图片无法加载)

将以下代码复制进去并保存关闭

{
    "registry-mirrors": ["https://registry.docker-cn.com","https://pee6w651.mirror.aliyuncs.com"]
}

invalid image (图片无法加载)

重启 docker 即可进行 docker pull 镜像下载操作

[root@localhost ~]# systemctl restart docker   //重启docker

下载成功

invalid image (图片无法加载)


yg9538 2022年9月8日 09:42 1833 收藏文档