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

我做错了什么?


当前回答

试试这个:

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

其他回答

我有一个问题,就像我需要使用代理使用谷歌的dns项目的依赖和API请求,同时需要与私人服务器通信。

对于RHEL7,我这样配置系统:

进入/etc/sysconfig/docker目录

Environment=http_proxy="http://ip:port"
Environment=https_proxy="http://ip:port"
Environment=no_proxy="hostname"

然后保存文件并使用命令:

Sudo systemctl restart docker

然后配置Dockerfile: 首先设置环境结构:

ENV http_proxy http://ip:port
ENV https_proxy http://ip:port
ENV no_proxy "hostname"

这是所有!:)

如果你使用的是Ubuntu,执行这些命令来添加代理。

sudo nano /etc/default/docker

并取消指定的行注释

#export http_proxy = http://username:password@10.0.1.150:8050

并将其替换为适当的代理服务器和用户名。

然后使用以下命令重新启动Docker:

service docker restart

现在你可以在代理后运行Docker命令:

docker search ubuntu

为了解决Docker构建中的curl问题,我在Dockerfile中添加了以下内容:

ENV http_proxy=http://infoprx2:8080
ENV https_proxy=http://infoprx2:8080
RUN apt-get update && apt-get install -y curl vim

注意,ENV语句在RUN语句之前。

为了使Docker守护进程能够访问Internet(我使用Kitematic和boot2docker),我在/var/lib/boot2docker/profile中添加了以下内容:

export HTTP_PROXY=http://infoprx2:8080
export HTTPS_PROXY=http://infoprx2:8080

然后我用sudo /etc/init.重启Dockerd /码头工人重新启动。

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

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

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

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

格式如下:

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

例子:

"geronimous:mypassword@192.168.44.55:8080"

仅此而已。

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

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

然后重新加载Docker:

service docker.io restart

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