zixiba

zixiba

Using SOCKS5 Proxy with Docker

  1. Create the Docker service plugin directory
sudo mkdir -p /etc/systemd/system/docker.service.d
  1. Create a file named http-proxy.conf
sudo touch /etc/systemd/system/docker.service.d/http-proxy.conf
  1. Edit the http-proxy.conf file
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
  1. Write the content (replace the proxy IP and proxy port with your own)
[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:1080" "HTTPS_PROXY=socks5://127.0.0.1:1080" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
  1. Reload the service program's configuration file
sudo systemctl daemon-reload
  1. Restart Docker
sudo systemctl restart docker
  1. Verify if the configuration was successful
systemctl show --property=Environment docker

At this point, Docker can pull files from the specified proxy.

Additionally, if you need to use an HTTP proxy, simply replace socks5 with http.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.