How to Configure Docker to Use a Proxy?

Reading time: 6 min read
Raj Vardhman
Written by
Raj Vardhman

Updated · Jan 03, 2024

Raj Vardhman
Chief Strategist, Techjury | Project Engineer, WP-Stack | Joined January 2023 | Twitter LinkedIn
Raj Vardhman

Raj Vardhman is a tech expert and the Chief Tech Strategist at, where he leads the rese... | See full bio

Girlie Defensor
Edited by
Girlie Defensor


Girlie Defensor
Joined June 2023
Girlie Defensor

Girlie is an accomplished writer with an interest in technology and literature. With years of experi... | See full bio

Techjury is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more.

​​Docker offers an excellent method for developers to work on a program or software. With this tool, you can package software in units known as containers. These containers include everything the software needs to work.

Due to its ability, developers have built over 3.5 million programs with Docker. Moreover, users have downloaded over 37 billion Docker-contained apps.

Despite the efficiency, Docker containers can have no web access sometimes. This is where proxies can help. Docker doesn't use a proxy by default, so configuration is necessary for a docker to use a proxy.

Keep reading to learn how to configure a docker to use a proxy!

🔑 Key Takeaways

  • Docker containers lacking direct internet access require proxy configuration to enable online functionality. Default settings don’t activate the proxy, necessitating manual adjustments.
  • To configure Docker with a proxy, you only need Docker itself and a proxy server. Docker is available across various operating systems, while the proxy server can be any server or computer with internet access.
  • Using Docker Desktop involves enabling manual proxy configuration via the settings, whereas editing the Docker Configuration file requires altering JSON-formatted code.
  • Proxy configurations are pivotal for Docker, ensuring continuous online functionality for software and apps. The provided methods equip users to sustain Docker connectivity even in scenarios of limited or no internet access.

How to Configure Docker to Use a Proxy?

A proxy is necessary when the Docker container has no direct Internet access. Although a container can support using a proxy, it’s not active by default. Thus, you must do some configurations for a container to work online using a proxy.

A Docker configuration is easy with the Docker Desktop because it already has proxy settings. However, with this step, you will only pull images from In short, you still need to configure the proxy within the container.

We'll also show how to use these steps as we move further. To give you an overview, below are the three methods we'll explain:

  • Manual configuration on Docker Desktop
  • Manual proxy variable configuration in the Docker Configuration file
  • Manual environment variables configuration

What You Need

You only need two things to configure Docker to use a proxy: Docker and the Proxy you'll use.


Most people use Docker on their computers, and it's available for Mac, Windows, and Linux. If you don't have the app yet, here are the following download links:

Proxy Server

You can use any proxy server you want for Docker to work. It can be another computer on your network with an Internet connection. Or it can be a hosting or domain server.

Steps to Configure Docker To Use A Proxy

As mentioned, we’ll show you three methods to configure Docker to use a proxy. 

Method 1: Manual configuration on Docker Desktop

This method is easy since the Docker app already includes proxy settings in its window. Here are the steps to do this method:

1. Download and Open Docker Desktop.

The first thing to do is to open the Docker Desktop app. The main Docker app window will vary slightly based on the OS used. However, once you download and open the Docker Desktop app, here's what you'll see:


2. Go to Settings.


3. Go to Resources, then Proxies


4. Enable 'Manual proxy configuration' and enter the proxy server.

In the Proxies Window, you’ll see that the Manual proxy configuration is off by default. You have to turn it on and enter the proxy server you want. The app allows either HTTP, HTTPS, or Hosts and Domains.

Manual proxy configuration

As mentioned, these settings will only let you pull an image from Docker. It’s not the same as configuring the proxy in the container itself. 


Remember, configuring proxies in Docker Desktop is simple via manual setup. Access 'Settings' > 'Resources' > 'Proxies,' enable 'Manual proxy configuration,' and input your server details. However, note this config solely enables image pulls, not container proxy setup.

Method 2: Manual proxy variable configuration in the Docker Configuration file

The Docker Configuration file is a file you can find as /etc/sysconfig/docker. With this config file, you can change how the Docker works. We'll use this file in this second method to configure Docker to use a proxy.

1. Add a configuration code in the Docker Configuration file.

Using your text editor, add the code below to your Docker configuration file:

Add a configuration code in the Docker Configuration file

You need to use the JSON format in editing. Ensure that the edits match the details of the proxy IP address you'll set up later. Here's an example of how it should look like:


2. Set up the proxy.

You can start setting up your proxy server once you're done with the edits on the configuration file. The setup process will differ based on the proxy type and OS you'll use.

You can set up the proxy before doing the first step, whichever works for you. You only need to match the proxy server details with the edits you'll make in the Docker configuration file.

3. Restart the Docker daemon

After you set up the proxy and save the edit on the file, restart Docker.

💡Pro Tip!

Precisely match proxy server details in the JSON-formatted Docker Configuration file (/etc/sysconfig/docker) to avoid connectivity issues. Validate proxy settings before restarting the Docker daemon to ensure accurate configuration, minimizing errors that could disrupt Docker's functionality. Keep a keen eye on logs post-restart for any misconfiguration hints, facilitating prompt troubleshooting if needed.

Method 3: Manual environment variables configuration

Environment variables refer to methods you can use to externalize an app configuration. With these variables, you can define several settings or values. It can also keep your apps organized and flexible. 

​​To configure a Docker to use a proxy, you can add an environment variable to support HTTP proxy.

1. Make a drop-in in Docker

You can make a drop-in in a Docker subdirectory file using the following:

 Make a drop-in in Docker

2. Make a document that provides a proxy environment variable:

Create a proxy environment variable in the drop-in you've just made.

Name the file:


Doing so lets you add the HTTP_PROXY environment variable in the drop-in.

Here's an example:


3. Reload the Daemon and then restart Docker.

Once you have the environment variable, reload the systemd daemon with this command:


Then, you have to restart Docker manually or using this command:

restart Docker

4. Verify the variable

Once the Docker is up again, verify if the variable works and the configuration is successful. Here's an example:

Verify the variable


Docker offers an efficient solution for testing, building, and running software and apps. When web access becomes necessary but limited, proxies can keep Docker running.

You can configure a docker to use a proxy with the above methods. Thus, any software or program can remain online even when Docker has limited or no Internet.


Does Docker use an HTTP proxy?

Docker doesn’t use an HTTP proxy by default. It's included in the Docker preferences. Besides an HTTP proxy, Docker also supports HTTPS, Hosting, and Domain proxies. You can turn it on with the Manual proxy configuration option.

Does Docker use IPv4 or IPv6?

A Docker container supports only IPv4 by default. If you have to use an IPv6 address, you have some configurations to do. However, you can use both versions simultaneously once you finish the changes.

Can Docker use a host VPN?

Docker Desktop supports the use of a host VPN. Thus, the Docker networking can be functional even if you attach it to a VPN


Facebook LinkedIn Twitter
Leave your comment

Your email address will not be published.