第一步:通过dig @114.114.114.114 registry-1.docker.io找到可用IP
navy@deepin:~/Desktop$ dig @114.114.114.114 registry-1.docker.io; <<>> DiG 9.11.3-1-Debian <<>> @114.114.114.114 registry-1.docker.io ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14010 ;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 4, ADDITIONAL: 4;; QUESTION SECTION: ;registry-1.docker.io. IN A;; ANSWER SECTION: registry-1.docker.io. 60 IN A 34.200.28.105 registry-1.docker.io. 60 IN A 52.22.67.152 registry-1.docker.io. 60 IN A 52.70.175.131 registry-1.docker.io. 60 IN A 52.22.201.61 registry-1.docker.io. 60 IN A 52.54.155.177 registry-1.docker.io. 60 IN A 52.206.40.44 registry-1.docker.io. 60 IN A 54.175.43.85 registry-1.docker.io. 60 IN A 54.165.149.19;; AUTHORITY SECTION: docker.io. 24420 IN NS ns-1827.awsdns-36.co.uk. docker.io. 24420 IN NS ns-421.awsdns-52.com. docker.io. 24420 IN NS ns-1168.awsdns-18.org. docker.io. 24420 IN NS ns-513.awsdns-00.net.;; ADDITIONAL SECTION: ns-1827.awsdns-36.co.uk. 9556 IN A 205.251.199.35 ns-421.awsdns-52.com. 541 IN A 205.251.193.165 ns-1168.awsdns-18.org. 16170 IN A 205.251.196.144 ns-513.awsdns-00.net. 13484 IN A 205.251.194.1;; Query time: 27 msec ;; SERVER: 114.114.114.114#53(114.114.114.114) ;; WHEN: Sun Nov 18 10:34:13 CST 2018 ;; MSG SIZE rcvd: 370
第二步:尝试修改/etc/hosts强制docker.io相关的域名解析到其它可用IP
vim /etc/hosts
添加一个可用IP:
34.200.28.105 registry-1.docker.io
保存之后重试:
navy@deepin:~/Desktop$ sudo docker pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu 473ede7ed136: Pull complete c46b5fa4d940: Pull complete 93ae3df89c92: Pull complete 6b1eed27cade: Pull complete Digest: sha256:29934af957c53004d7fb6340139880d23fb1952505a15d69a03af0d1418878cb Status: Downloaded newer image for ubuntu:latest
验证:
navy@deepin:~/Desktop$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest ea4c82dcd15a 4 weeks ago 85.8MB
成功!