无法停泊 - 连接被拒绝

时间:2018-05-02 09:08:20

标签: docker

我在ubuntu虚拟机中从docker运行以下命令,并且连接被拒绝错误。

我支持公司代理,并已配置我的环境可用性以使用代理,用户名和密码。我也尝试过使用代理链。

root@mbak1-VirtualBox:~# sudo proxychains docker pull busybox
ProxyChains-3.1 (http://proxychains.sf.net)
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 54.152.209.167:443: getsockopt: connection refused

root@mbak1-VirtualBox:~# docker pull hello-world
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 35.169.231.249:443: getsockopt: connection refused

我的情况似乎与以下内容完全相同:

enter image description here

更新

我尝试将我的代理配置添加到以下文件中但它没有用。此外,该文件不存在:/ etc / sysconfig / docker。

我也尝试访问实际的网址,但我收到的JSON回复是未经授权的。

https://github.com/moby/moby/issues/31510

UPDATE2

我认为问题是我的DNS配置。 在虚拟机中,我得到以下内容进行查找:

mbak1@mbak1-VirtualBox:~$ nslookup registry-1.docker.io
Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
Name:   registry-1.docker.io
Address: 34.200.28.105
Name:   registry-1.docker.io
Address: 52.54.216.153
Name:   registry-1.docker.io
Address: 34.200.90.16
Name:   registry-1.docker.io
Address: 52.204.202.231
Name:   registry-1.docker.io
Address: 52.22.181.254
Name:   registry-1.docker.io
Address: 54.152.209.167
Name:   registry-1.docker.io
Address: 34.205.207.96
Name:   registry-1.docker.io
Address: 35.169.231.249

1 个答案:

答案 0 :(得分:7)

我的问题的答案来自这篇文章:https://community.ubnt.com/t5/UNMS-Beta/Connection-Refused-Failed-to-pull-docker-images/m-p/2220235/highlight/true#M3960

我正在重新发布:

Hi Radek,



I managed to find a solution by adding a proxy for docker. Thank you for your help.




Create a systemd drop-in directory for the docker service:

$ sudo mkdir -p /etc/systemd/system/docker.service.d



Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"


Or, if you are behind an HTTPS proxy server, create a file called /etc/systemd/system/docker.service.d/https-proxy.conf that adds the HTTPS_PROXY environment variable:

[Service]
Environment="HTTPS_PROXY=https://proxy.example.com:443/"


If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"


Or, if you are behind an HTTPS proxy server:

[Service]
Environment="HTTPS_PROXY=https://proxy.example.com:443/" "NO_PROXY=localhost,127.0.0.1,docker registry.somecorporation.com"


Flush changes:

$ sudo systemctl daemon-reload


Restart Docker:

$ sudo systemctl restart docker


Verify that the configuration has been loaded:

$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/


Or, if you are behind an HTTPS proxy server:

$ systemctl show --property=Environment docker
Environment=HTTPS_PROXY=https://proxy.example.com:443/
相关问题