I'm trying to run docker inside a EC2 VM instance. The instance is behind a http proxy.
As far as I can tell the docker install went okay.
Here is the instance information
Linux ip-X-X-X-X 3.8.0-31-generic #46~precise1-Ubuntu SMP Wed Sep 11 18:21:16 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
The docker version I've is
Docker version 0.6.3, build b0a49a3
When I try to run a simple docker command it hangs for a long time.
$sudo docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' (tag: latest) locally
Pulling repository ubuntu
I've a feeling that this has something to do with my HTTP proxy settings.
I tried setting proxy in different ways.
For example based on this I tried but it still doesn't work.
$sudo HTTP_PROXY=http://proxy.xyz.com:8080 docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' (tag: latest) locally
Pulling repository ubuntu
Any idea what am I missing here?
You need to be running the Docker daemon with your HTTP_PROXY environment variable, since the pulling of images happens through the daemon. If you're on Ubuntu, this can be accomplished by modifying /etc/init/docker.conf
.
Update:
We also correctly support /etc/default/docker
now, so the best way to accomplish this now (on Ubuntu and Debian) is via export http_proxy=...
inside /etc/default/docker
.
On Amazon Linux, append proxy variables in /etc/sysconfig/docker
export no_proxy='localhost,127.0.0.0/8'
export NO_PROXY='localhost,127.0.0.0/8'
export http_proxy=http://<YOUR_PROXY>:<PROXY_PORT>/
export HTTPS_PROXY=http://<YOUR_PROXY>:<PROXY_PORT>/
export https_proxy=http://<YOUR_PROXY>:<PROXY_PORT>/
export HTTP_PROXY=http://<YOUR_PROXY>:<PROXY_PORT>/
and then restart docker daemon
service docker restart
Something to add to tianon's answer is after modifying the config file don't forget to restart the docker daemon:
sudo service docker restart
to apply the proxy.