问题类型
- 错误
当尝试从中拉出docker容器时,我遇到了这个错误:
使用默认标签:最新 守护进程的错误响应:获取https://registry-1.docker.io/v2/:net/http:等待连接时请求被取消(等待标头时超出 Client.Timeout)
## OS version
Ubuntu 18.04 (bionic)
## Docker version
Client:
Version: 18.09.4
API version: 1.39
Go version: go1.10.8
Git commit: d14af54266
Built: Wed Mar 27 18:35:44 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.4
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: d14af54
Built: Wed Mar 27 18:01:48 2019
OS/Arch: linux/amd64
Experimental: false
重现步骤
docker pull hello-world
我没有使用代理或 VPN(我在其他帖子中看到过关于此错误的问题)
我尝试寻找解决方法,但无济于事。service docker restart
无法解决问题。我发现将“nameserver 8.8.8.8”添加到 etc/resolv.conf 可以暂时解决问题,但 resolv.conf 会自动重写/更新为旧版本,因此这不是理想的解决方案。我过去能够从这台计算机和我当前网络上的 docker hub 中提取 docker 镜像,因此可能是某些设置发生了更改,导致了此问题。任何帮助都将不胜感激!非常感谢。
。
如果相关的话,这里是输出docker info
:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 9
Server Version: 18.09.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-1035-oem
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.05GiB
Name: ###(redacted)###
ID: ###(redacted)###
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No swap limit support
使用 127.0.0.53的输出dig index.docker.io
(resolv.conf 中的默认值)
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> index.docker.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57173
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;index.docker.io. IN A
;; ANSWER SECTION:
index.docker.io. 300 IN CNAME elb-io.us-east-1.aws.dckr.io.
elb-io.us-east-1.aws.dckr.io. 899 IN CNAME us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com.
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 59 IN A 52.207.42.240
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 59 IN A 3.91.211.1
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 59 IN A 52.54.178.62
;; Query time: 404 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Apr 15 09:36:42 MDT 2019
;; MSG SIZE rcvd: 212
dig index.docker.io
使用 8.8.8.8的输出
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> index.docker.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37695
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;index.docker.io. IN A
;; ANSWER SECTION:
index.docker.io. 133 IN CNAME elb-io.us-east-1.aws.dckr.io.
elb-io.us-east-1.aws.dckr.io. 837 IN CNAME us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com.
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 56 IN A 52.207.42.240
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 56 IN A 3.91.211.1
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 56 IN A 52.54.178.62
;; Query time: 19 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Apr 15 09:49:22 MDT 2019
;; MSG SIZE rcvd: 212
答案1
您的 Docker 安装可能没有问题。
如果将 DNS 更改为 8.8.8.8 可以解决问题,那么您从 8.8.8.8 获得的地址可能与从常规 DNS 服务获得的地址不同。您可以使用dig
以下两种配置来获取地址:
dig index.docker.io
; <<>> DiG 9.10.3-P4-Ubuntu <<>> index.docker.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28068
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;index.docker.io. IN A
;; ANSWER SECTION:
index.docker.io. 926 IN CNAME elb-io.us-east-1.aws.dckr.io.
elb-io.us-east-1.aws.dckr.io. 926 IN CNAME us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com.
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 926 IN A 52.54.178.62
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 926 IN A 3.91.211.1
us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com. 926 IN A 52.207.42.240
;; Query time: 2 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Sun Apr 14 09:15:20 CEST 2019
;; MSG SIZE rcvd: 214
如果您不想更改 DNS,您仍然可以在 中添加上述地址之一/etc/hosts
,重新启动时不会重置此地址。当然,这会阻止您使用集群中的其他服务器,并且您选择的特定地址可能会失效。
如果您的标准 DNSresolv.conf
是 127.0.0.something,则您的系统可能设置为使用 NetworkManager 控制的dsnmasq
:DNS 查询由系统上的服务处理,该服务会将它们转发到后台的各种 DNS。您可以使用以下方法找出实际使用的 DNS(DNS 是按网络接口设置的):
nmcli dev show | grep DNS
然后从那里继续寻找慢速/无效的 DNS。