- mkdir /etc/systemd/system/docker.service.d
- 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
- docker info | grep -i proxy 查看代理是否生效
HTTP Proxy: http://192.168.56.101:8080
HTTPS Proxy: http:/192.168.56.101:8080