How to manage access to multiple private repos via multiple proxies. Each private repo is accessible via different proxy.
Currently when I need to docker login to private repo over a proxy I’m using this configuration from the docker documentation:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
-----------------------------------------------------------------------------
[Service]
Environment="HTTP_PROXY=http://proxy01:3128"
Environment="HTTPS_PROXY=http://proxy01:3128"
Environment="NO_PROXY=localhost,127.0.0.1,redhat.com,docker.io"
-----------------------------------------------------------------------------
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl show --property=Environment docker
docker login -u <user> -p <pwd> <private_repository>
If you need to access another private repo you have to rewrite the systemd service configuration and restart the service. This becomes quite painful if you need to script or use the docker in CICD.
For example with podman you can use just
HTTPS_PROXY=http://proxy01:3128 podman login ...