Configure docker to use an HTTP proxy server

Revision history
Tags: docker systemd

There are several ways to configure this, some of which are simpler or harder, but I think this was an interesting way to do it.

# mkdir -p /etc/systemd/system/docker.service.d
# echo -e '[Service]\nEnvironment="HTTP_PROXY=http://[::1]:8080/"' > /etc/systemd/system/docker.service.d/http-proxy.conf

Reload configuration and restart the docker daemon

# systemctl daemon-reload
# systemctl restart docker

Verify that docker is run with the new environment

# systemctl show --property Environment docker
Environment=GOTRACEBACK=crash DOCKER_HTTP_HOST_COMPAT=1 HTTP_PROXY=http://[::1]:8080/

References

If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.