Configuring proxy in Docker

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 http_proxy and 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= .

Or we can specify the http_proxy value using the ENV instruction within the Dockerfile.

FROM ubuntu

ENV http_proxy ""
ENV https_proxy ""

re-run the build.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s