本文翻译自: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 . 来源是这篇博客文章 。