Skip to content

Instantly share code, notes, and snippets.

@alphamarket
Last active January 14, 2025 04:25
Show Gist options
  • Save alphamarket/404fb8dda86edfe204ab38719379833a to your computer and use it in GitHub Desktop.
Save alphamarket/404fb8dda86edfe204ab38719379833a to your computer and use it in GitHub Desktop.
How to make docker pull using a socks5 proxy

Create the config file:

mkdir -p /etc/systemd/system/docker.service.d && \
vi /etc/systemd/system/docker.service.d/http-proxy.conf

Put up the configs:

[Service]
Environment="ALL_PROXY=socks5h://127.0.0.1:1080"
Environment="HTTP_PROXY=socks5h://127.0.0.1:1080"
Environment="HTTPS_PROXY=socks5h://127.0.0.1:1080"

Flush changes:

sudo systemctl daemon-reload

Verify that the configuration has been loaded:

sudo systemctl show --property Environment docker

Restart Docker:

sudo systemctl restart docker
@sunjunps
Copy link

sunjunps commented Aug 3, 2024

It worked, use socks5 instead of socks5h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment