Linux上的Docker:所有操作(hello world、pull image等)都会产生超时
我知道这是一个常见的问题,但我花了两个小时试图通过docker run hello world,我完全被难倒了 我尝试的所有操作都会产生一个等待连接超时的net/http 正在运行Linux上的Docker:所有操作(hello world、pull image等)都会产生超时,linux,docker,nameservers,Linux,Docker,Nameservers,我知道这是一个常见的问题,但我花了两个小时试图通过docker run hello world,我完全被难倒了 我尝试的所有操作都会产生一个等待连接超时的net/http 正在运行docker登录: Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. U
docker登录
:
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: ******
Password:
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
运行hello world:
mike@tictac:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
我的docker版本是一个干净的AFAIK安装:
mike@tictac:~$ docker --version
Docker version 18.09.0, build 4d60db4
我尝试将8.8.8.8添加到/etc/resolv.conf中,但没有成功:
mike@tictac:~$ cat /etc/resolv.conf
# Generated by NetworkManager
search home
nameserver 127.0.0.53
nameserver 8.8.8.8
我认为我的/etc/hosts文件也很好:
mike@tictac:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 tictac
8.8.8.8 tictac
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
这是我的码头工人信息:
mike@tictac:~$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.0
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: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-33-generic
Operating System: Linux Mint 19
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 15.37GiB
Name: tictac
ID: J54P:ILHO:J76M:AF27:MDKJ:BIDS:WODK:MA6N:IICP:TIMJ:BIUN:H56O
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://proxy.example.com:80/
HTTPS Proxy: http://1.1.1.1:111
No Proxy: localhost,127.0.0.1,docker-registry.somecorporation.com
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
我已经确认docker确实在运行:
mike@tictac:~$ sudo service docker status
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─10_docker_proxy.conf, http-proxy.conf
Active: active (running) since Fri 2018-11-16 11:06:36 EST; 6min ago
Docs: https://docs.docker.com
Main PID: 6190 (dockerd)
Tasks: 22
CGroup: /system.slice/docker.service
└─6190 /usr/bin/dockerd -H unix://
如果我能通过hello world,我会很高兴的
编辑:同样相关,我可以直接卷曲URL,很好:
mike@tictac:~/Projects/conserve-with-us/conserve-with-us-api$ curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
在这种情况下,我通常怀疑代理配置,而您的
docker info
也显示了一些不一致的HTTP/HTTPS和旁路配置
HTTP Proxy: http://proxy.example.com:80/
HTTPS Proxy: http://1.1.1.1:111
No Proxy: localhost,127.0.0.1,docker-registry.somecorporation.com
通常大多数人根本不需要设置这些,但一些公司强制执行不透明的代理设置,但在这些情况下,前两个通常相同,对于旁路配置,它可能还包括/var/run/docker.sock
我将删除或重置docker deamon和客户端的所有代理配置,以确保它们都匹配:
代理配置:dockerd代理
代理配置:docker客户端
http\u代理
、https\u代理
和proxy\u旁路
环境变量也与您预期的代理配置相匹配:
env | grep proxy
因此,您可以在curl或其他支持这些功能的linux应用程序上看到相同的结果。非常感谢!它最终成为我的代理配置(我在说明中安装了一些东西,这些东西不仅我不需要,而且实际上使我的安装无法工作)
sudorm-rf/etc/systemd/system/docker.service.d/
成功了