dockerdocker-composedocker-registrysocks

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


I use port-forwarding like this:

ssh -vND 1080 user@server_ip

Question:

How can I pull docker images with socks5?

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


Solution

  • You can set the proxy config in the services systemd config (/etc/systemd/system/docker.service.d/http-proxy.conf):

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

    docker pull socks proxy

    The service config works for docker-compose pull as well: docker-compose pull socks proxy