..

How to apply SOCKS5 proxy for docker pull?

First open /etc/docker/config.json then add the following data in it:

    {
        "proxies":
        {
            "default":
            {
                "httpProxy": "socks5h://127.0.0.1:30808",
                "httpsProxy": "socks5h://127.0.0.1:30808",
                "noProxy": "localhost,127.0.0.1"
            }
        }
    }

After restarting your docker service using systemctl restart docker the change will be done.

For docker build the story is different and you can use the following command to apply it per command, docker run example is included too:

docker build --build-arg HTTP_PROXY="http://127.0.0.1:30808" .
docker run --env HTTP_PROXY="http://127.0.0.1:30808" redis