Docker设置代理

# 创建一个systemd的目录
sudo mkdir -p /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=https://proxy.example.com:443"
Environment="NO_PROXY=localhost,127.0.0.1"

# daemon-reload
sudo systemctl daemon-reload
# 重启docker
sudo systemctl restart docker

# 查询是否配置成功(可选)
sudo systemctl show --property=Environment docker