Proxy setting in Docker Toolbox

If you are behind a corporate proxy, you might end with a connection error while running this command :

docker search jenkins

Here is how to set up Docker so that it works behind a corporate proxy:
1) Edit the Docker VM /var/lib/boot2docker/profile

$ docker-machine ssh default
docker@default:~$ sudo vi /var/lib/boot2docker/profile 

2) Add these lines at the end of the file :

# replace PROXY and PORT with the corporate proxy and port values
export "HTTP_PROXY=http://PROXY:PORT"
export "HTTPS_PROXY=http://PROXY:PORT"
# add the IPs, URLs which do no need proxy
export "NO_PROXY=192.168.99.*,*.local,169.254/16,*,192.168.59.*"

3) Finally, restart Docker :

sudo /etc/init.d/docker restart

4) Try again to search for the jenkins image :

docker search jenkins