Skip to content

Instantly share code, notes, and snippets.

@kuznero
Last active July 6, 2018 17:01
Show Gist options
  • Save kuznero/c996ed78f50ba9035121 to your computer and use it in GitHub Desktop.
Save kuznero/c996ed78f50ba9035121 to your computer and use it in GitHub Desktop.
Work with Docker behind proxy

Work with Docker behind proxy

Docker on Linux OS

Following instructions are from official docuementation:

sudo mkdir /etc/systemd/system/docker.service.d

Create file /etc/systemd/system/docker.service.d/http-proxy.conf with the following content:

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:3128/"

And restart docker:

sudo systemctl daemon-reload
sudo systemctl show docker | grep -i environment    # should emit configured proxy settings
sudo systemctl restart docker

Docker Toolbox for Windows

In order to define proxy you would need to connect to default vhost and configure proxy settings there:

# docker-machine ssh default
# sudo -i
# echo "export HTTP_PROXY=http://your.proxy.name:8080" >> /var/lib/boot2docker/profile
# echo "export HTTPS_PROXY=http://your.proxy.name:8080" >> /var/lib/boot2docker/profile
# /etc/init.d/docker restart
# exit
# exit

After that in your docker client you can pull any images from public docker repository:

# docker pull hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment