Vous êtes sur la page 1sur 1

Cannot download Docker images behind a proxy - Stack Overflow https://stackoverflow.com/questions/23111631/cannot-download-docke...

Cannot download Docker images behind a proxy

20 Answers

¿No encuentras la respuesta? Pregunta en Stack Overflow en español. ✕

That's an old subject, but I'll give my tw o cents in case someone else is looking for advice.

Here is a link to the official docker doc for proxy http: https://docs.docker.com/engine/admin
/systemd/#http-proxy

A quick outline:

First, create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

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/"

If you have internal Docker registries that you need to contact w ithout 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"

Flush changes:

$ sudo systemctl daemon-reload

Verify that the configuration has been loaded:

$ sudo systemctl show --property Environment docker


Environment=HTTP_PROXY=http://proxy.example.com:80/

Restart Docker:

$ sudo systemctl restart docker

edited Aug 18 '16 at 20:42 answered Jan 22 '15 at 16:13


lucian ciufudean Alexandre Mélard
381 3 8 5,099 2 19 37

2 T his works for Debian Jessie running Docker 1.6.2. Somehow editing /etc/default/docker does
not work. Maybe I should remove export like the one documented for Centos. – neurite Nov 5 '15
at 19:29

2 For me this worked over the selected answer. Ubuntu 15.10 – Kshitiz Sharma Dec 3 '15 at 4:05

2 For older SysV edit /etc/sysconfig/docker as in docs.oracle.com/cd/E37670_01/E37355/html/… -


Oracle Linux 6.7 – SidJ Jan 7 '16 at 3:26

16 Works for Ubuntu 16.04 for me. – labyrinth Apr 21 '16 at 21:00

3 For ubuntu 14.04 refer @n3o 's answer, Since systemctl is not available for ubuntu 14.04, it uses
upstart to bring up the services. – chinmay Sep 16 '16 at 12:43

Your APT proxy settings are not related to Docker.

Docker uses the HTTP_PROXY environment variable if present, for example:

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.
Then restart the Docker server:

service docker restart

1 de 1 13/12/2017 10:13

Vous aimerez peut-être aussi