当我们使用docker下载镜像时报错:
[root@lyy local]# docker pull tomcat Using default tag: latest Trying to pull repository docker.io/library/tomcat ... Get https://registry-1.docker.io/v2/library/tomcat/manifests/latest: Get https:/
解决方法:
[root@lyy local]# yum install bind-utils 安装dig工具 [root@lyy local]# dig @114.114.114.114 registry-1.docker.io
; <<>> DiG 9.9.4-RedHat-9.9.4-74.el7_6.2 <<>> @114.114.114.114 registry-1.docker.io ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31043 ;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;registry-1.docker.io. IN A ;; ANSWER SECTION: registry-1.docker.io. 35 IN A 34.201.196.144 registry-1.docker.io. 35 IN A 34.199.77.19 registry-1.docker.io. 35 IN A 34.199.40.84 registry-1.docker.io. 35 IN A 34.232.31.24 registry-1.docker.io. 35 IN A 52.2.186.244 registry-1.docker.io. 35 IN A 52.55.198.220 registry-1.docker.io. 35 IN A 34.197.189.129 registry-1.docker.io. 35 IN A 34.228.211.243 ;; Query time: 12 msec ;; SERVER: 114.114.114.114#53(114.114.114.114) ;; WHEN: 三 9月 18 13:11:42 CST 2019 ;; MSG SIZE rcvd: 177
选择上面命令执行结果中ANSWER SECTION:下的一组解析IP,放到本机的 /etc/hosts 文件里做映射,示例:
[root@docker-registry ~]# vi /etc/hosts 34.199.77.19 registry-1.docker.io