Skip to content

Instantly share code, notes, and snippets.

@sunjunps
Forked from alphamarket/http-proxy.conf.md
Created August 3, 2024 05:39
Show Gist options
  • Save sunjunps/6e948e0bf1f37b9e22539e1f8ea2b21f to your computer and use it in GitHub Desktop.
Save sunjunps/6e948e0bf1f37b9e22539e1f8ea2b21f 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment