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

我做错了什么?


当前回答

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

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

然后重新加载Docker:

service docker.io restart

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

其他回答

试试这个:

sudo HTTP_PROXY=http://<IP address of proxy server:port> docker -d & 

在Ubuntu上,你需要为Docker守护进程设置http_proxy,而不是客户端进程。这是在/etc/default/docker中完成的(参见这里)。

您的APT代理设置与Docker无关。

Docker使用HTTP_PROXY环境变量(如果存在)。例如:

sudo HTTP_PROXY=http://192.168.1.1:3128/ docker pull busybox

但是,我建议您查看一下您的/etc/default/dockerconfiguration文件:您应该有一行来取消注释(可能还会进行调整)以自动应用代理设置。然后重新启动Docker服务器:

service docker restart

在Docker的新版本中,Docker -engine,在一个基于systemd的发行版中,你应该在/lib/systemd/system/ Docker中添加环境变量line。服务,正如其他人所提到的:

Environment="HTTP_PROXY=http://hostname_or_ip:port/"

在1.0.1版本中,简单地设置代理环境变量并没有帮助我…我必须更新/etc/default/docker。IO文件中包含“http_proxy”变量的正确值。