A proxy is required when the server running on Docker does not have direct access to the Internet.
Configure the Docker daemon to use a proxy server to access Docker images stored in the official Docker Hub Registry or any other registries.
We simply need to set the
https_proxy environmental variables during build time. We can do this with the
docker build command itself.
$ sudo docker build -t curl --build-arg http_proxy=http://192.168.33.10:3128 .
Or we can specify the
http_proxy value using the
ENV instruction within the
#Dockerfile FROM ubuntu ENV http_proxy "http://192.168.80.10:3333" ENV https_proxy "http://192.168.80.10:3333"
re-run the build.