How to configure docker when behind a proxy

If you use docker behind a proxy you need to specify the corresponding environment variables to download images from internet. In my case I use docker on a mac os hence I use boot2docker Linux based virtual machine to host the docker process. Here are few simple steps to configure the proxy for boot2docker (version 1.1.1):

1. Login to the host vm
bash-3.2$ boot2docker ssh

2. find where the docker configuration is stored
docker@boot2docker:~$ ls -la /etc/init.d/docker
lrwxrwxrwx 1 root root 28 Jul 17 07:46 /etc/init.d/docker -> /usr/local/etc/init.d/docker

3. If you cat the startup script you’ll see something like
#import settings from profile (e.g. HTTP_PROXY, HTTPS_PROXY)
test -f "/var/lib/boot2docker/profile" && . "/var/lib/boot2docker/profile"

4. Check to see if profile file exists and add the needed configuration
vi /var/lib/boot2docker/profile

export HTTP_PROXY=http://{proxy_host}:{proxy_port}
export HTTPS_PROXY=https://{proxy_host}:{proxy_port}

5. Restart the docker process
sudo /etc/init.d/docker restart

That’s it now you can pull docker images if you’re behind a proxy.


Maven based project with tomcat 7.0, jersey 2.2 and arquillian 1.0

this small blog is inspired from jersey 2.2 user guide, particularly section 1 :).
The guide is just fine, featuring quite a number of examples enriched with explanations and references. While I was browsing through it I was thinking what if I change a bit the running environment with components I prefer for both developing and testing.

The examples in the guide require grizzly, which I changed with tomcat.
The tests are plain junit which I changed with arquillian in-container test adding arquillian tomcat container.

If you’re interested how this look like check the maven based project located here: