我在Ubuntu 13.10 (Saucy Salamander)上安装了Docker,当我在控制台输入:

sudo docker pull busybox

我得到以下错误:

Pulling repository busybox
2014/04/16 09:37:07 Get https://index.docker.io/v1/repositories/busybox/images: dial tcp: lookup index.docker.io on 127.0.1.1:53: no answer from server

码头工人版本:

$ sudo docker version

Client version: 0.10.0
Client API version: 1.10
Go version (client): go1.2.1
Git commit (client): dc9c28f
Server version: 0.10.0
Server API version: 1.10
Git commit (server): dc9c28f
Go version (server): go1.2.1
Last stable version: 0.10.0

我在一个没有身份验证的代理服务器后面,这是我的/etc/apt/apt.conf文件:

Acquire::http::proxy "http://192.168.1.1:3128/";
Acquire::https::proxy "https://192.168.1.1:3128/";
Acquire::ftp::proxy "ftp://192.168.1.1:3128/";
Acquire::socks::proxy "socks://192.168.1.1:3128/";

我做错了什么?


当前回答

在RHEL6.6上只能这样(注意使用export):

/etc/sysconfig/docker

export http_proxy="http://myproxy.example.com:8080"
export https_proxy="http://myproxy.example.com:8080"

注意:两者都可以使用http协议。)

感谢https://crondev.com/running-docker-behind-proxy/

其他回答

在Ubuntu 14.04 (Trusty Tahr)和Docker 1.9.1上,我只是取消了http_proxy行注释,更新了值,然后重新启动Docker服务。

export http_proxy="http://proxy.server.com:80"

然后

service docker restart

从环境变量中删除代理

unset http_proxy
unset https_proxy
unset no_proxy

然后重新启动docker

如果你在Ubuntu上,你应该执行这个命令:

export https_proxy=http://your_name:password@ip_proxy:port docker 

然后重新加载Docker:

service docker.io restart

或者进入/etc/docker。IO与纳米…

在我的网络中,Ubuntu在一个企业ISA代理服务器后面工作。而且它需要身份验证。我尝试了上面提到的所有解决方案,但都没有帮助。真正有帮助的是在/etc/systemd/system/docker.service.d/https-proxy.conf文件中写一个没有域名的代理行。

而不是

Environment="HTTP_PROXY=http://user@domain:password@proxy:8080"

or

Environment="HTTP_PROXY=http://domain\user:password@proxy:8080"

和一些其他替换,如@ -> %40或\ -> \\ \我尝试使用

Environment="HTTP_PROXY=http://user:password@proxy:8080"

现在它起作用了。

也许你需要设置小写变量。在我的例子中,我的/etc/systemd/system/docker.service.d/http-proxy.conf文件看起来像这样:

[Service]
Environment="ftp_proxy=http://<user>:<password>@<proxy_ip>:<proxy_port>/"
Environment="http_proxy=http://<user>:<password>@<proxy_ip>:<proxy_port>/"
Environment="https_proxy=http://<user>:<password>@<proxy_ip>:<proxy_port>/"

好运!:)