一、错误重现
error pulling image configuration: download failed after attempts=6: dial tcp 31.13.88.169:443: i/o timeout |
在执行docker build构建镜像,拉取镜像时报错
或者直接docker pull镜像时报错
实质都是拉取镜像源超时报错,那么就是镜像源的问题
二、解决方法
1、配置镜像源
vim /etc/docker/daemon.json
输入以下内容
{"registry-mirrors":["https://i1el1i0w.mirror.aliyuncs.com","https://hub-mirror.c.163.com","https://registry.aliyuncs.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn"]
}
或者直接使用tee命令添加(二选一即可)
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors":["https://i1el1i0w.mirror.aliyuncs.com","https://hub-mirror.c.163.com","https://registry.aliyuncs.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn"]
}
EOF
2、重启docker服务
重启守护进程
sudo systemctl daemon-reload
重启服务
sudo systemctl restart docker
再次尝试成功了