docs: add environment variables configuration method for Docker daemon#25075
docs: add environment variables configuration method for Docker daemon#25075mohithshuka wants to merge 3 commits into
Conversation
The previous description said 'optimize your repository storage' which was vague and did not reflect the page's actual content. The manage.md page is focused on viewing, filtering, and deleting images and image indexes. Updated the description to accurately reflect this. Fixes docker#25005
The daemon configuration overview only mentioned two methods (JSON file and flags) but was missing the environment variables method via systemd. Added a new section explaining how to use systemd drop-in overrides to set daemon environment variables. Fixes docker#25062
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Addresses issue #25062 by expanding the Docker daemon configuration overview to mention environment variables as an additional configuration method, and adds a new "Configuration using environment variables" section showing a systemd drop-in example.
Changes:
- Updates the intro list from "two ways" to "three ways" and adds an environment-variables bullet.
- Adds a new section demonstrating
systemctl edit dockerwith anEnvironment="DOCKER_OPTS=..."drop-in and a reload/restart sequence.
Comments suppressed due to low confidence (3)
content/manuals/engine/daemon/_index.md:49
- The list now describes three configuration methods, but the sentence below still says "both of these options together," which only refers to two. This should be updated to reflect that three methods exist (e.g., "You can combine these options...") and clarify how environment variables interact with the JSON file and flags.
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
won't start and prints an error message.
content/manuals/engine/daemon/_index.md:113
- The opening fence uses 6 backticks while the closing fence uses 5, so the code block is unbalanced and will not render correctly. Use matching fences (typically 3 backticks) on both sides.
``````ini
[Service]
Environment="DOCKER_OPTS=--debug --tls=true"
**content/manuals/engine/daemon/_index.md:120**
* The opening fence uses 4 backticks while the closing fence uses 3, leaving the code block unbalanced. Use matching fences on both ends.
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
```
```
</details>
---
💡 <a href="/docker/docs/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.| ````````console | ||
| $ sudo systemctl edit docker | ||
| ``````` |
| ### 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: | ||
|
|
||
| ````````console | ||
| $ sudo systemctl edit docker | ||
| ``````` | ||
|
|
||
| Add the following: | ||
|
|
||
| ``````ini | ||
| [Service] | ||
| Environment="DOCKER_OPTS=--debug --tls=true" | ||
| ````` | ||
|
|
||
| Then reload and restart the daemon: | ||
|
|
||
| ````console | ||
| $ sudo systemctl daemon-reload | ||
| $ sudo systemctl restart docker | ||
| ``` |
| - 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. |
|
|
||
| ``````ini | ||
| [Service] | ||
| Environment="DOCKER_OPTS=--debug --tls=true" |
There was a problem hiding this comment.
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?
| 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: |
There was a problem hiding this comment.
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)
What changed
Added a new "Configuration using environment variables" section to the
Docker daemon configuration overview page.
Why
The page stated there are "two ways" to configure the Docker daemon
(JSON file and flags) but was missing the environment variables method
using systemd drop-in overrides.
Fixes #25062
Testing