How to configure docker to use HTTP proxy


Posted by Munish Mehta on Tuesday, March 13, 2018
This article will show you how to configure docker to use HTTP proxy
configuring proxy for docker

Ubuntu

Set docker to use http proxy

sudo /etc/default/docker

export http_proxy="http://127.0.0.1:3128/"
export https_proxy="http://127.0.0.1:3128/"
export HTTP_PROXY="http://127.0.0.1:3128/"
export HTTPS_PROXY="http://127.0.0.1:3128/"

Load configuration and restart docker

sudo service docker restart

CentOS

Set docker to use http proxy

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

echo '
[Service]
Environment="HTTP_PROXY=http://proxy.foo.bar.com:80/"
' | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf

Load configuration and restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker


Work Behind The Writing

This article comes from real-world AI and DevOps engineering work.

If the thinking here is useful, explore the projects behind it or get in touch about a similar technical problem.
comments powered by Disqus