无法在代理服务器后面下载Docker图像 [英] Cannot download Docker images behind a proxy

查看:162
本文介绍了无法在代理服务器后面下载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

这篇关于无法在代理服务器后面下载Docker图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆