Here’s a quick way to configure docker to work with proxy. Keep in mind that this only works if you are using boot2docker or a docker-machine. This generally applies to Windows or Mac operating systems.
Create a new docker-machine with proxy:
docker-machine create -d virtualbox \
--engine-env HTTP_PROXY=http://user:firstname.lastname@example.org:port \
--engine-env HTTPS_PROXY=https://user:email@example.com:port \
--engine-env NO_PROXY=example2.com \
Edit user, password, example.com and port variables with appropriate values. Also, make sure you have correct domains excluded within NO_PROXY variable.
To change proxy credentials later on, edit /var/lib/boot2docker/profile and set HTTP_PROXY and HTTPS_PROXY environment variables.