今天用docker pull 镜像时提示以下错误
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文件即可,没有该文件则在以上路径自行创建
将以下代码复制进去并保存关闭
{
"registry-mirrors": ["https://registry.docker-cn.com","https://pee6w651.mirror.aliyuncs.com"]
}
重启docker即可进行docker pull 镜像下载操作
[root@localhost ~]# systemctl restart docker //重启docker
下载成功