创建目录
mkdir /etc/systemd/system/docker.service.d
创建文件
/etc/systemd/system/docker.service.d/http-proxy.conf
填入内容
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="HTTPS_PROXY=http://proxy.example.com:80/"
# 如果需要绕过
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"
重载
$ sudo systemctl daemon-reload
重启Docker
$ sudo systemctl restart docker