FreeInternet icon indicating copy to clipboard operation
FreeInternet copied to clipboard

Docker using HTTP proxy

Open ffletcherr opened this issue 2 years ago • 0 comments

This is not an issue. Just instructions and bash scripts to force docker to use (HTTP) proxy. Based on this StackOverflow answer:

https://stackoverflow.com/a/28093517/11927768

Run this to start using proxy:

#!/bin/bash
sudo mkdir /etc/systemd/system/docker.service.d
echo "[Service]
Environment=HTTP_PROXY=http://127.0.0.1:1080
Environment=HTTPS_PROXY=http://127.0.0.1:1080" | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker

** change 1080 to match your HTTP proxy port.

Run this to stop using proxy:

#!/bin/bash
sudo rm /etc/systemd/system/docker.service.d/http-proxy.conf
sudo touch /etc/systemd/system/docker.service.d/http-proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker

ffletcherr avatar Nov 15 '22 12:11 ffletcherr