systemctl status docker查看docker的状态和配置文件是/usr/lib/systemd/system/docker.service
vi /usr/lib/systemd/system/docker.service, 增加如下配置项
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080" "HTTPS_PROXY=http://proxy.example.com:8080" "NO_PROXY=localhost,127.0.0.1,.example.com"
重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker
执行docker info查看代理配置是否生效
拉取镜像,验证代理是否工作
docker pull hello-world