I installed Docker on my Ubuntu 13.10 (Saucy Salamander) and when I type in my console:
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:
$ 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:
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?
This is the fix that worked for me: Ubuntu, Docker version: 1.6.2
In the file
/etc/default/docker
, add the line:Restart Docker
Why a locally-bound proxy doesn't work
The Problem
If you're running a locally-bound proxy, e.g. listening on
127.0.0.1:8989
, it WON'T WORK in Docker for Mac. From the Docker documentation:The similar is for Docker server side. (To understand the server side and client side of Docker, try to run
docker version
.) And the server side runs on a virtualization layer which has its ownlocalhost
. Therefore, it won't connect to the proxy server on thelocalhost
of the host OS.The solution
So, if you're using a locally-bound proxy like me, basically you would have to do the following things to make it work with Docker for Mac:
Make your proxy server listen on
0.0.0.0
instead of127.0.0.1
. Caution: you'll need proper firewall configuration to prevent malicious access to it.Add a loopback alias to the
lo0
interface, e.g.10.200.10.1/24
:Set HTTP and/or HTTPS proxy to
10.200.10.1:8989
from Preferences in Docker tray menu (assume that the proxy server is listening on port8989
).After that, test the proxy settings by running a command in a new container from an image which is not downloaded:
Notice: the loopback alias set by
ifconfig
does not preserve after a reboot. To make it persistent is another topic. Please check this blog post in Japanese (Google Translate may help).In the new version of Docker, docker-engine, in a systemd based distribution, you should add the environment variable line to /lib/systemd/system/docker.service, as it is mentioned by others:
As I am not allowed to comment yet:
For CentOS 7 I needed to activate the EnvironmentFile within "docker.service" like it is described here: Control and configure Docker with systemd.
Edit: I am adding my solution as stated out by Nilesh. I needed to open "/etc/systemd/system/docker.service" and I had to add within the section
Only then was the file "etc/sysconfig/docker" loaded on my system.