Docker代理设置

0
11

* 修改配置文件

sudo rm -f /etc/systemd/system/docker.service.d/http-proxy.conf

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

添加内容,按需替换你的地址
cat <<'EOF' | sudo tee /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.88:20171"
Environment="HTTPS_PROXY=http://192.168.1.88:20171"
Environment="NO_PROXY=localhost,127.0.0.1,::1,*.local,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
EOF"
  • 重新加载配置并重启 Docker
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl restart docker
  • 验证是否生效
    systemctl show docker --property=Environment
    docker pull hello-world

发布回复

请输入评论!
请输入你的名字