无法在代理服务器后面下载Docker图像
我在ubuntu 13.10上安装了docker,当我输入我的控制台时:
I installed docker on my ubuntu 13.10 and when I type in my console:
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
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
我没有身份验证的代理服务器,这是我的/etc/apt/apt.conf:
I am behind a proxy server with no authentication, this is my /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/";
我做错了什么?
这是一个老主题,但是如果有人正在寻找建议,我会给我两分钱。
That's an old subject, but I'll give my two cents in case someone else is looking for advice.
这是一个链接到官方docker doc代理http:
https:// docs.docker.com/engine/admin/systemd/#http-proxy
Here is a link to the official docker doc for proxy http: https://docs.docker.com/engine/admin/systemd/#http-proxy
快速大纲:
首先,为docker服务创建一个systemd drop-in目录:
First, create a systemd drop-in directory for the docker service:
mkdir /etc/systemd/system/docker.service.d
现在创建一个名为 / etc / systemd / system / docker.service.d / http-proxy.conf
添加了 HTTP_PROXY
环境变量:
Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf
that adds the HTTP_PROXY
environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
如果您需要联系内部Docker注册表没有代理,您可以通过 NO_PROXY
环境变量指定它们:
If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY
environment variable:
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"
刷新更改:
$ sudo systemctl daemon-reload
验证配置是否已加载:
$ sudo systemctl show --property Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/
重新启动Docker:
Restart Docker:
$ sudo systemctl restart docker