Skip to content

Instantly share code, notes, and snippets.

@Tset-Noitamotua
Last active November 19, 2015 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tset-Noitamotua/f53e2825f69b5cb1541e to your computer and use it in GitHub Desktop.
Save Tset-Noitamotua/f53e2825f69b5cb1541e to your computer and use it in GitHub Desktop.
HOW TO: Use Docker behind proxy (on Windows)

OPTION I

Start the Docker Quickstart Terminal and follow this steps ($ ==> terminal prompt):

$ docker-machine start default

$ eval $(docker-machine env default )

ssh into the machine named 'default' and update docker VM's /var/lib/boot2docker/profile

$ docker-machine ssh default

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

Add below line in end of file:

(replace with your office's proxy environment)

export "HTTP_PROXY=http://PROXY:PORT"
export "HTTPS_PROXY=http://PROXY:PORT"
# you can add more no_proxy with your environment. 
export "NO_PROXY=192.168.99.*,*.local,169.254/16,*.example.com,192.168.59.*"

restart / exit docker daemon

docker@default:~$ sudo /etc/init.d/docker restart
docker@default:~$ exit
$ docker search ubuntu

Now you should be fine to pull and push images. Kitematic works as well.

If you are back to home, just remove/comment proxy settings in /var/lib/boot2docker/profile and restart the docker daemon.

All done and enjoy with it.

OPTION II

And also since version 1.8, docker-machine now supports the configuration of the proxies at VM creation time via an invocation like the following:

$ docker-machine create -d virtualbox \
    --engine-env HTTP_PROXY=http://user:password@proxyhost:port \
    --engine-env HTTPS_PROXY=http://192.37.246.181:2010 \
    --engine-env NO_PROXY=*.localhost \
    machinename
@Tset-Noitamotua
Copy link
Author

Source OPTION I: docke/toolbox issue #102 (how to set proxy in docker toolbox?)

Source OPTION II: stackoverflow.com - Docker/Boot2Docker: set proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment