如何配置docker使用HTTP代理
preview image

Ubuntu

设置 docker 使用 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/"

加载配置并重启 docker

sudo service docker restart

CentOS

设置 docker 使用 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

加载配置并重启 docker

sudo systemctl daemon-reload
sudo systemctl restart docker

TAGS
On this page