docker pull配置代理方法
需求
docker已换163源,某些冷门或较新镜像仍然会从docker.io进行下载,需要代理。
方法
对于docker这种级别的应用,环境变量需要经由systemd传入。
sudo vi /etc/systemd/system/docker.service.d/proxy.conf
# Add content below
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:7890/"
Environment="HTTPS_PROXY=http://127.0.0.1:7890/"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
# Take effect
sudo systemctl daemon-reload
sudo systemctl restart docker
参考
Cannot download Docker images behind a proxy - Stack Overflow