---
title: Use a proxy server with the Docker CLI
linkTitle: Proxy configuration
weight: 20
description: How to configure the Docker client CLI to use a proxy server
keywords: network, networking, proxy, client
aliases:
- /network/proxy/
---
This page describes how to configure the Docker CLI to use proxies via
environment variables in containers.
This page doesn't describe how to configure proxies for Docker Desktop.
For instructions, see [configuring Docker Desktop to use HTTP/HTTPS proxies](/manuals/desktop/settings-and-maintenance/settings.md#proxies).
If you're running Docker Engine without Docker Desktop, refer to
[Configure the Docker daemon to use a proxy](/manuals/engine/daemon/proxy.md)
to learn how to configure a proxy server for the Docker daemon (`dockerd`) itself.
If your container needs to use an HTTP, HTTPS, or FTP proxy server, you can
configure it in different ways:
- [Configure the Docker client](#configure-the-docker-client)
- [Set proxy using the CLI](#set-proxy-using-the-cli)
> [!NOTE]
>
> Unfortunately, there's no standard that defines how web clients should handle proxy
> environment variables, or the format for defining them.
>
> If you're interested in the history of these variables, check out this blog
> post on the subject, by the GitLab team:
> [We need to talk: Can we standardize NO_PROXY?](https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/).
## Configure the Docker client
You can add proxy configurations for the Docker client using a JSON
configuration file, located in `~/.docker/config.json`.
Builds and containers use the configuration specified in this file.
```json
{
"proxies": {
"default": {
"httpProxy": "http://proxy.example.com:3128",
"httpsProxy": "https://proxy.example.com:3129",
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
}
```
> [!WARNING]
>
> Proxy settings may contain sensitive information. For example, some proxy servers
> require authentication information to be included in their URL, or their
> address may expose IP-addresses or hostnames of your company's environment.
>
> Environment variables are stored as plain text in the container's configuration,
> and as such can be inspected through the remote API or committed to an image
> when using `docker commit`.
The configuration becomes active after saving the file, you don't need to
restart Docker. However, the configuration only applies to new containers and
builds, and doesn't affect existing containers.
The following table describes the available configuration parameters.
| Property | Description |
| :----------- | :---------------------------------------------------------------------------------- |
| `httpProxy` | Sets the `HTTP_PROXY` and `http_proxy` environment variables and build arguments. |
| `httpsProxy` | Sets the `HTTPS_PROXY` and `https_proxy` environment variables and build arguments. |
| `ftpProxy` | Sets the `FTP_PROXY` and `ftp_proxy` environment variables and build arguments. |
| `noProxy` | Sets the `NO_PROXY` and `no_proxy` environment variables and build arguments. |
| `allProxy` | Sets the `ALL_PROXY` and `all_proxy` environment variables and build arguments. |
These settings are used to configure proxy environment variables for containers
only, and not used as proxy settings for the Docker CLI or the Docker Engine
itself.
Refer to the [environment variables](/reference/cli/docker/#environment-variables)
and [configure the Docker daemon to use a proxy server](/manuals/engine/daemon/proxy.md)
sections for configuring proxy settings for the CLI and daemon.