In the previous post, I’ve described how to build an image when you’re behind a proxy.
Now, if your container needs access to the internet for e.g. downloading python dependencies, you’ll need to give it explicitly. The way to do it is via
-e parameter (environment) of
docker run. You can either make it verbose, or you can build an alias:
alias docker_run="docker run \ -e http_proxy=$http_proxy \ -e https_proxy=$https_proxy \ -e no_proxy=$no_proxy "
Then, you can just execute:
docker_run -d myimage:myversion