如何使用 socks5 代理制作 docker-compose 拉取图像?

How can I make docker-compose pull images using a socks5 proxy?

我这样使用port-forwarding

ssh -vND 1080 user@server_ip

问题:

如何使用 socks5 提取 docker 个图像?

pulling docker images with the docker pull command already has an answer here. But I want to use docker-compose for pulling images

您可以在服务中设置代理配置 systemd 配置 (/etc/systemd/system/docker.service.d/http-proxy.conf):

[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:1080"

服务配置也适用于 docker-compose pull

如果您的服务由 systemd 维护,请在服务配置文件中设置 http proxyhttps proxy/etc/systemd/system/docker.service.d/proxy.conf:

[Service]
Environment="HTTP_PROXY=socks5://<proxy host>:<port>"
Environment="HTTPS_PROXY=socks5://<proxy host>:<port>"

然后,重启docker服务:

systemctl daemon-reload
systemctl restart docker