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

1sudo /etc/default/docker
2
3export http_proxy="http://127.0.0.1:3128/"
4export https_proxy="http://127.0.0.1:3128/"
5export HTTP_PROXY="http://127.0.0.1:3128/"
6export HTTPS_PROXY="http://127.0.0.1:3128/"

Load configuration and restart docker

1sudo service docker restart

CentOS

Set docker to use http proxy

1sudo mkdir -p /etc/systemd/system/docker.service.d
2
3echo '
4[Service]
5Environment="HTTP_PROXY=http://proxy.foo.bar.com:80/"
6' | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf

Load configuration and restart docker

1sudo systemctl daemon-reload
2sudo systemctl restart docker

comments powered by Disqus