无法在代理后面下载Docker镜像

本文翻译自:Cannot download Docker images behind a proxy

I installed Docker on my Ubuntu 13.10 (Saucy Salamander) and when I type in my console: 我在我的Ubuntu 13.10(Saucy Salamander)上安装了Docker,当我输入我的控制台时:

sudo docker pull busybox

I get the following error: 我收到以下错误:

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

Docker version: Docker版本:

$ 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

I am behind a proxy server with no authentication, and this is my /etc/apt/apt.conf file: 我在没有身份验证的代理服务器后面,这是我的/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/";

What am I doing wrong? 我究竟做错了什么?


#1楼

参考:https://stackoom.com/question/1yYof/无法在代理后面下载Docker镜像


#2楼

Your APT proxy settings are not related to Docker. 您的APT代理设置与Docker无关。

Docker uses the HTTP_PROXY environment variable if present, for example: Docker使用HTTP_PROXY环境变量(如果存在),例如:

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

But instead, I suggest you have a look at your /etc/default/docker configuration file : you should have a line to uncomment (and maybe adjust) to get your proxy settings applied automatically. 但相反,我建议您查看/etc/default/docker配置文件:您应该有一行来取消注释(并可能调整)以自动应用代理设置。 Then restart the Docker server: 然后重启Docker服务器:

service docker restart

#3楼

After installing Docker, do the following: 安装Docker后,执行以下操作:

[mdesales@pppdc9prd1vq ~]$ sudo HTTP_PROXY=http://proxy02.ie.xyz.net:80 ./docker -d &
[2] 20880

Then, you can pull or do anything: 然后,你可以拉或做任何事情:

mdesales@pppdc9prd1vq ~]$ sudo docker pull base
2014/04/11 00:46:02 POST /v1.10/images/create?fromImage=base&tag=
[/var/lib/docker|aa088847] +job pull(base, )
Pulling repository base
b750fe79269d: Download complete
27cf78414709: Download complete
[/var/lib/docker|aa088847] -job pull(base, ) = OK (0)

#4楼

On CentOS the configuration file for Docker is at: 在CentOS上,Docker的配置文件位于:

/etc/sysconfig/docker

Adding the below line helped me to get the Docker daemon working behind a proxy server: 添加以下行帮助我让Docker守护程序在代理服务器后面工作:

HTTP_PROXY="http://<proxy_host>:<proxy_port>"
HTTPS_PROXY="http://<proxy_host>:<proxy_port>"

#5楼

On Ubuntu you need to set the http_proxy for the Docker daemon, not the client process. 在Ubuntu上,您需要为Docker守护进程设置http_proxy,而不是客户端进程。 This is done in /etc/default/docker (see here ). 这在/etc/default/docker (参见此处 )。


#6楼

To extend Arun's answer above, for this to work in CentOS 7, I had to remove the "export" commands. 为了扩展Arun上面的答案,为了在CentOS 7中工作,我不得不删除“export”命令。 So edit 所以编辑

/etc/sysconfig/docker

And add: 并添加:

HTTP_PROXY="http://<proxy_host>:<proxy_port>"
HTTPS_PROXY="https://<proxy_host>:<proxy_port>"
http_proxy="${HTTP_PROXY}"
https_proxy="${HTTPS_PROXY}"

Then restart Docker: 然后重启Docker:

sudo service docker restart

The source is this blog post . 来源是这篇博客文章

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值