docker设置代理

  1. mkdir /etc/systemd/system/docker.service.d
  2. touch /etc/systemd/system/docker.service.d/http-proxy.conf,内容如下
[Service]
Environment="HTTP_PROXY=http://192.168.56.101:8080"

3.touch /etc/systemd/system/docker.service.d/https-proxy.conf,内容如下

[Service]
Environment="HTTPS_PROXY=http://192.168.56.101:8080"

4.systemctl daemon-reload 重新加载配置
5.systemctl restart docker 重启docker

  1. docker info | grep -i proxy 查看代理是否生效
 HTTP Proxy: http://192.168.56.101:8080
 HTTPS Proxy: http:/192.168.56.101:8080

你可能感兴趣的:(docker设置代理)