Docker Building using a proxy


Often when building a Docker image, the Dockerfile contains instructions that runs programs to fetch resources from the Internet (wget for example to pull a program binary build on GitHub for example).

It is possible to instruct Docker to pass set set environment variables so that such programs perform those fetches through a proxy:

$ docker build --build-arg http_proxy= \
               --build-arg https_proxy= \
               --build-arg \
               -t test .

build-arg are environment variables which are available at build time only.