himanshub16/ProxyMan

Add support for docker

Closed this issue · 3 comments

Adding proxy settings for docker would be very nice :-)

I haven't worked with Docker. However, going through docker's documentation, I found that settings are placed at ~/.docker/config.json. Is that what you are looking for?

I would avoid messing with JSON as it might contain more config parameters.
Is there way to do it from CLI (as git config)?
Also, does docker obey environment variables?

What I meant is the configuration of the docker daemon. To be able to pull docker images from the internet. https://docs.docker.com/config/daemon/systemd/ Configurable in /etc/systemd/system/docker.service.d/http-proxy.conf

tuxfy commented

Hi,

I use this snippet for docker ubunut 18. Maybe you can modify it. I will try to add this to your awesome scripts, too. But I need some time to understand the code before :)

echo -e "#docker.conf"
echo -e "------------------------------------------"
sudo rm -r /etc/systemd/system/docker.service.d
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
[Service]
Environment="HTTP_PROXY=http://$AUTH$SERVER:$PORT/"
Environment="HTTPS_PROXY=http://$AUTH$SERVER:$PORT/"
Environment="NO_PROXY=localhost,127.0.0.1,localaddress,.spd.de"
EOF

    sudo systemctl daemon-reload
    sudo systemctl restart docker

	echo -e "Proxy environment variable has been setup!"
fi