Skip to content

Instantly share code, notes, and snippets.

@alphamarket
Last active March 19, 2026 10:55
Show Gist options
  • Select an option

  • Save alphamarket/404fb8dda86edfe204ab38719379833a to your computer and use it in GitHub Desktop.

Select an option

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

sunjunps commented Aug 3, 2024

Copy link
Copy Markdown

It worked, use socks5 instead of socks5h

@hg

hg commented Mar 19, 2026

Copy link
Copy Markdown

Note that you can avoid manually creating override files and running daemon-reload by simply doing:

systemctl edit docker

It will create a drop-in file, open it in the editor, and then reload systemd state after the editor is finished.

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