Configuring Docker in order to run properly behind a company proxy

Quick post to remember how to setup Docker in order to run behind a proxy:

1. Create docker service configuration file:

sudo mkdir /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/http-proxy.conf
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf

Add the following:


where xxx is the host and yyy is the port of course!

2. Check and apply configuration:

sudo systemctl daemon-reload

Check proper configuration:

sudo systemctl show --property Environment docker

Restart docker if the command output is correct:

sudo systemctl restart docker

You might wish to customize your bashrc too (~/.bashrc), by adding:

export http_proxy="http://xxx:yyy"
export https_proxy="https://xxx:yyy"