Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion content/manuals/engine/daemon/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ This page shows you how to customize the Docker daemon, `dockerd`.

## Configure the Docker daemon

There are two ways to configure the Docker daemon:
There are three ways to configure the Docker daemon:

- Use a JSON configuration file. This is the preferred option, since it keeps
all configurations in a single place.
- Use flags when starting `dockerd`.
- Use environment variables to set daemon options.

You can use both of these options together as long as you don't specify the same
option both as a flag and in the JSON file. If that happens, the Docker daemon
Expand Down Expand Up @@ -92,6 +93,32 @@ running:
$ dockerd --help
```

### Configuration using environment variables

You can configure the Docker daemon using environment variables. This is useful
in systemd service overrides or init scripts.

To set environment variables for the Docker daemon using systemd, create a
drop-in override file:
Comment on lines +98 to +102
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment; I think this is a very limited use-case, so not 100% sure if we should advertise this here; we could link to the https://docs.docker.com/reference/cli/dockerd/#environment-variables section to make users aware of environment variables that are supported, but possibly leave it an exercise to the user to use those (which is just general systemd knowledge)


````````console
$ sudo systemctl edit docker
```````
Comment on lines +104 to +106

Add the following:

``````ini
[Service]
Environment="DOCKER_OPTS=--debug --tls=true"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not something we support, the DOCKER_OPTS env-var was a legacy option before systemd;
https://github.com/moby/moby/blob/721883f7329e0c555ec00126ecb3bbe5511d50f5/contrib/init/openrc/docker.confd#L31-L32

some options can also be set through environment variables, but the list is limited;
https://docs.docker.com/reference/cli/dockerd/#environment-variables

So, not entirely sure if we want to advertise this as an alternative to the daemon.json or CLI flags, because it's not a replacement (only for some options).

cc @dvdksn any thoughts?

`````

Then reload and restart the daemon:

````console
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
```
Comment on lines +96 to +120

## Daemon data directory

The Docker daemon persists all data in a single directory. This tracks
Expand Down
Loading