镜像仓库访问失败
Q1:Error response from daemon: Get https://index.docker.io/v1/search?q=sameersbn&n=25: net/http: TLS handshake timeout Q2: docker: Get https://registry-1.docker.io/v2/: net/http: request canceled (Client.Timeout exceeded while awaiting headers). Q3: docker: Head https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: net/http: request canceled (Client.Timeout exceeded while awaiting headers).
解决方案如下:
以下方案二选一,适合自己的才是最好的,这个去阿里云自己的账户使用就行
1.修改替换国内源
1.修改docker源配置文件 vim /etc/docker/daemon.json 2.修改成阿里云的源 保存退出文件 {"registry-mirrors": ["https://cr.console.aliyun.com","http://hub-mirror.c.163.com"]} 3.重启守护进程 systemctl daemon-reload 4.重启docker systemctl restart docker
2.强制指定docker hub访问地址修改主机host
1.通过dig找到可用IP dig @114.114.114.114 registry-1.docker.io
[root@ShardingNode ~]# dig @114.114.114.114 registry-1.docker.io ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7 <<>> @114.114.114.114 registry-1.docker.io ;; OPT PSEUDOSECTION: ;; ANSWER SECTION: ;; Query time: 37 msec |
2.选择一个修改hosts文件
vim /etc/hosts
52.72.232.213 registry-1.docker.io
验证配置
docker search sameersbn