例如:
$ docker pull ubuntu:16.04
Trying to pull repository docker.io/library/ubuntu ...
Get https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:dd7808d8792c9841d0b460122f1acf0a2dd1f56404f8d1e56298048885e45535: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io: read tcp *.*.*.*:41348->50.17.62.194:443: read: connection reset by peer
原因: 目测 50.17.62.194 被 TCP RESET 。
解决方法:
$ dig auth.docker.io
; <<>> DiG 9.10.4-P6-RedHat-9.10.4-4.P6.fc25 <<>> auth.docker.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7119
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;auth.docker.io. IN A
;; ANSWER SECTION:
auth.docker.io. 60 IN A 34.193.147.40
auth.docker.io. 60 IN A 50.17.62.194
auth.docker.io. 60 IN A 52.5.246.212
;; Query time: 130 msec
;; SERVER: *.*.*.*#53(.*.*.*.*)
;; WHEN: Tue Mar 07 11:03:29 CST 2017
;; MSG SIZE rcvd: 91
/etc/hosts
强制 docker.io 相关的域名解析到其它可用 IP :# /etc/hosts
34.193.147.40 registry-1.docker.io auth.docker.io
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.