Last Updated: February 25, 2016
·
13.62K
· jsolis

Docker Setup on Mac behind Corp Proxy

Install Docker Toolbox (1.8.3 or later). You can download the latest version from here: https://www.docker.com/toolbox

There will be two quick updates to your setup. The first will be to tell your machine to not use a proxy when trying to connect to your Docker Machine (VM), and the second will be to configure your Docker Machine to use your proxy in order to connect out to the InterWebs for things like downloading images from Docker Hub.

First, add your Docker Machine VM's IP to your no_proxy list in ~/.bash_profile - so your docker client can communicate with your Docker Machine without trying to go through your proxy.

To get your Docker Machine's IP:

> docker-machine ip default

Substitute default for whatever the name of your Docker Machine is.

Take that IP and add it to your existing no_proxy. Example if your Docker Machine IP was 192.168.99.100:

export no_proxy='localhost,corp.domain.com,192.168.99.100'

Second, configure your docker VM with your proxy settings - so your Docker Machine can communicate to the InterWebs

> docker-machine ssh default
> sudo vi /var/lib/boot2docker/profile

Now paste in your proxy settings.
Example:

export HTTP_PROXY={your corp proxy url}
export HTTPS_PROXY={your corp proxy url}
export NO_PROXY={stuff you don't want to go through a proxy for}

Now exit out of your Docker Machine VM and restart it so the new proxy settings can take affect.

> exit
> docker-machine restart default

You should be good to go when your VM finishes booting up, but one last proxy tip...if you wish to run Kitematic, it for some reason ignores your system proxy settings (a bug IMO), so you'll have to pass the proxy information to the application.

> http_proxy=http://PROXY:PORT https_proxy=http://PROXY:PORT open /Applications/Docker/Kitematic\ \(Beta\).app/

Alternatively, if you prefer CLI, Docker Quickstart Terminal should just work, and if you like to do things yourself, you can start things up manually

> docker-machine start default
> eval $(docker-machine env default )