我在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/";

我做错了什么?


当前回答

也许你需要设置小写变量。在我的例子中,我的/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>/"

好运!:)

其他回答

这是对我有效的修复:Ubuntu, Docker版本:1.6.2

在/etc/default/docker文件中,添加一行:

export http_proxy='http://<host>:<port>'

重启码头工人

sudo service docker restart

完整的解决方案,为Windows,配置代理设置。

< user>:< password>@< proxy-host>:< proxy-port>

你可以通过右键单击Docker图标中的“设置”,然后单击“代理”来直接配置它。

在那里,您可以配置代理地址、端口、用户名和密码。

格式如下:

< user>:< password>@< proxy-host>:< proxy-port>

例子:

"geronimous:mypassword@192.168.44.55:8080"

仅此而已。

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

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

然后

service docker restart

在防火墙后面,我也面临着同样的问题。请遵循以下步骤:

$ sudo vim /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment="HTTP_PROXY=http://username:password@IP:port/"

不要使用或删除https_prxo .conf文件。

重新加载并重新启动Docker容器:

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557*********************************8
Status: Downloaded newer image for hello-world:latest

这并不能完全回答问题,但可能会有所帮助,特别是如果您不想处理服务文件的话。

如果您是托管映像的人,一种方法是将映像转换为tar存档,在服务器上使用类似以下的东西。

docker save <image-name> --output <archive-name>.tar

只需下载存档并将其转换回图像即可。

docker load <archive-name>.tar