/etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080/"
Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
然后重启:
systemctl daemon-reload
systemctl restart docker
docker-compose 方式
environment:
- http_proxy=http://10.0.0.2:1080
- https_proxy=http://10.0.0.2:1080
就行了