新建:/etc/systemd/system/docker.service.d/proxy.conf
文件,文件内容如下:
[Service]
Environment="HTTP_PROXY=socks5://192.168.1.2:1080"
Environment="HTTPS_PROXY=socks5://192.168.1.2:1080"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
然后重新启动 docker 服务
systemctl daemon-reload
systemctl restart docker