docker下载镜像超时问题:Get https://registry-1.docker.io/v2/
使用docker下载镜像时,出现下面错误: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).
·
使用docker下载镜像时,出现下面错误:
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).
刚开始以为是镜像源问题,更改后没有效果
# 操作系统:centos7
# 编辑daemon.json文件
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}
# 重启docker
systemctl restart docker
接下来进行以下操作,解决了上述无法下载的问题
# 第一步:下载dig工具
yum install bind-utils
# 第二步:
dig @114.114.114.114 registry-1.docker.io
# 返回内容如下
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.2 <<>> @114.114.114.114 registry-1.docker.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45192
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;registry-1.docker.io. IN A
;; ANSWER SECTION:
registry-1.docker.io. 1 IN A 34.197.211.151
registry-1.docker.io. 1 IN A 54.236.165.68
registry-1.docker.io. 1 IN A 34.192.204.44
registry-1.docker.io. 1 IN A 52.72.232.213
registry-1.docker.io. 1 IN A 18.214.230.110
registry-1.docker.io. 1 IN A 34.198.213.42
registry-1.docker.io. 1 IN A 107.23.149.57
registry-1.docker.io. 1 IN A 52.204.76.244
;; Query time: 5 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Fri Dec 18 20:08:55 CST 2020
;; MSG SIZE rcvd: 166
# 第三步:接下来我们只需要把以下信息追加到/etc/hosts
34.197.211.151 registry-1.docker.io
54.236.165.68 registry-1.docker.io
34.192.204.44 registry-1.docker.io
52.72.232.213 registry-1.docker.io
18.214.230.110 registry-1.docker.io
34.198.213.42 registry-1.docker.io
107.23.149.57 registry-1.docker.io
52.204.76.244 registry-1.docker.io
接下来docker pull xx镜像,没有报错就可以正常拉取镜像了。
不过,可能会出现证书过期或无效的报错(一般是本地系统时间错误导致报错证书过期)
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid.
# 安装
yum install ntpdate
# 同步时间
ntpdate cn.pool.ntp.org
更多推荐
已为社区贡献2条内容
所有评论(0)