Skip to content

Instantly share code, notes, and snippets.

@mshafiee
Created October 26, 2016 06:56
Show Gist options
  • Save mshafiee/ebca26152cb7685a5075a724f1f4209a to your computer and use it in GitHub Desktop.
Save mshafiee/ebca26152cb7685a5075a724f1f4209a to your computer and use it in GitHub Desktop.
HTTP proxy
This example overrides the default docker.service file.
If you are behind an HTTP proxy server, for example in corporate settings, you will need to add this configuration in the Docker systemd service file.
Create a systemd drop-in directory for the docker service:
sudo mkdir /etc/systemd/system/docker.service.d
Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://89.40.126.228:3128"
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
Flush changes:
sudo systemctl daemon-reload
Verify that the configuration has been loaded:
$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/
Restart Docker:
sudo systemctl restart docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment