Daemon proxy configuration
If your organization uses a proxy server to connect to the internet, you may need to configure the Docker daemon to use the proxy server. The daemon uses a proxy server to access images stored on Docker Hub and other registries, and to reach other nodes in a Docker swarm.
This page describes how to configure a proxy for the Docker daemon. For instructions on configuring proxy settings for the Docker CLI, see Configure Docker CLI to use a proxy server.
Proxy configurations specified in the
daemon.json
are ignored by Docker Desktop. If you use Docker Desktop, you can configure proxies using the Docker Desktop settings.
There are two ways you can configure these settings:
- Configuring the daemon through a configuration file or CLI flags
- Setting environment variables on the system
Configuring the daemon directly takes precedence over environment variables.
Daemon configuration
You may configure proxy behavior for the daemon in the daemon.json
file, or using CLI flags for the --http-proxy
or --https-proxy
flags for the dockerd
command. Configuration using daemon.json
is recommended.
1
2
3
4
5
6
7
{
"proxies": {
"http-proxy": "http://proxy.example.com:3128",
"https-proxy": "https://proxy.example.com:3129",
"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
HTTPS_PROXY
can start withhttp://
.
After changing the configuration file, restart the daemon for the proxy configuration to take effect:
1
$ sudo systemctl restart docker