I am using Docker for mac behind a proxy. I set up the proxy configuration in the Docker GUI under "Proxies" -> "Manual proxy configuration". This lets me download Docker images from the repository behind the proxy.
Next, I set the http_proxy
and https_proxy
environment variables and I use them in my docker-compose.yml to pass them to the build:
services:
app:
build:
context: .
args:
http_proxy: $http_proxy
https_proxy: $https_proxy
How can I get the variables that I set through the Docker GUI in the terminal so I don't have to set them twice? Are there any Docker-specific environment variables that I can use?
Install proxycap or redsocks and relieve yourself from the annoying proxy errors for all your tools and not just Docker. Proxycap/Redsocks transparently redirect traffic to the specified proxy that you have, so you don't configure any proxy settings anymore.
Update: There is a docker image for redsocks in case you cannot install it on the host machine. https://hub.docker.com/r/ncarlier/redsocks/
If I understood correctly want you want, then you just need to read what's given by docker info
:
❯ docker info | grep Proxy
Http Proxy: http://localhost:3128
Https Proxy: http://localhost:3128
If these two are set in the GUI, they will appear near the end of the output. If they are not set, they won't, and in my case, No Proxy: *.local, 169.254/16
will appear instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With