沙滩星空的博客沙滩星空的博客

使用socks5代理拉取docker镜像

问题

国内互联网环境状况堪忧。最近连国内各大docker镜像源都用不了。拉取Docker镜像一直失败。尝试用HTTP代理也经常报错。发现还是socks5代理好用。

代理设置

mkdir -p /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/http-proxy.conf

/etc/systemd/system/docker.service.d/http-proxy.conf 文件添加内容:

[Service]
Environment="HTTP_PROXY=socks5://user:pass@127.0.0.1:1080"
Environment="HTTPS_PROXY=socks5://user:pass@127.0.0.1:1080"

重启docker

systemctl daemon-reload
systemctl restart docker

查看环境变量:

sudo systemctl show --property=Environment docker

Docker Hub 镜像加速 https://gitee.com/wanfeng789/docker-hub

未经允许不得转载:沙滩星空的博客 » 使用socks5代理拉取docker镜像

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址