解决`docker pull`被 reset 的问题

2017-03-07 11:08:53 +08:00
 raysonx

例如:

$ 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 。

解决方法:

  1. 找到其它可用 IP :
$ 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
  1. /etc/hosts强制 docker.io 相关的域名解析到其它可用 IP :
# /etc/hosts
34.193.147.40 registry-1.docker.io auth.docker.io
9009 次点击
所在节点    程序员
7 条回复
joshz
2017-03-07 11:22:58 +08:00
registry 在国内连接总是各种问题,不知道是不是墙在作梗,先 mark 下
knightdf
2017-03-07 11:29:27 +08:00
在墙内, 10 次 pull8 次 timeout2 次 reset
viila
2017-03-07 12:27:27 +08:00
ss -> polipo -> HTTPS_PROXY
or 自建海外 registry 私用 + tag / dns 强制解析
or 国内海量的 registry-mirror ,高校的比如 tuna 或者 ustc ,不过 gcr.io 好像没找到替代的。
cloverstd
2017-03-07 12:32:41 +08:00
zgqq
2017-03-07 13:25:46 +08:00
@knightdf 我这边翻墙也是一样的
Eleutherios
2017-03-07 14:41:32 +08:00
HTTP_PROXY=socks5://localhost:5000 docker pull ~~~

ref: https://github.com/docker/docker/issues/5989
gwind
2017-03-07 16:35:32 +08:00
https://www.daocloud.io/mirror
或自己 vps 搭建 docker cache registry

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/345517

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX