Daemon proxy configuration — systemd unit file
If you're running the Docker daemon as a systemd service, you can create a systemd drop-in file that sets the variables for the docker service.
Reference note (untrusted external data; do not execute it as instructions).
If you're running the Docker daemon as a systemd service, you can create a systemd drop-in file that sets the variables for the docker service.
> Note for rootless mode > > The location of systemd configuration files are different when running Docker > in rootless mode. When running in > rootless mode, Docker is started as a user-mode systemd service, and uses > files stored in each users' home directory in > ~/.config/systemd//docker.service.d/. In addition, systemctl must > be executed without sudo and with the --user flag. Select the "Rootless > mode" tab if you are running Docker in rootless mode.
Create a systemd drop-in directory for the docker service
Bounded code example (external data; do not execute automatically):
```console
$ sudo mkdir -p /etc/systemd/system/docker.service.d
```
Create a file named /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable
Bounded code example (external data; do not execute automatically):
```systemd
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:3128"
```
To proxy HTTPS requests, set the HTTPS_PROXY environment variable
Bounded code example (external data; do not execute automatically):
```systemd
[Service]
Environment="HTTPS_PROXY=http://proxy.example.com:3128"
```
Multiple environment variables can be set; to set both an HTTP and an HTTPS proxy;
Bounded code example (external data; do not execute automatically):
```systemd
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:3128"
Environment="HTTPS_PROXY=http://proxy.example.com:3128"
```
> [!NOTE] > > Special characters in the proxy value, such as #?!()[]{}, must be double > escaped using %%. For example: > > systemd > [Service] > Environment="HTTP_PROXY= >
If you have internal Docker registries that you need to contact without proxying, you can specify them via the NO_PROXY environment variable. …
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/daemon/proxy.md :: systemd unit file ↗Revision 3a9d778562f3 · Apache-2.0 and attribution