Docker Swarm secrets: share sensitive data with running services
Answer: Docker secrets let swarm services use sensitive data without storing it in an image or in source control.
What a secret is for
Secrets are encrypted during transit and at rest in a Docker swarm.
Only services granted explicit access can read a given secret, and only while their tasks are running.
Typical secret data includes passwords, TLS certificates, SSH keys, and other sensitive strings or binary content up to 500 kb.
Docker secrets are only available to swarm services, not to standalone containers.
How secrets show up in a task
You can also use secrets to manage non-sensitive data, such as configuration files.
For that non-sensitive material, Docker supports the use of configs.
The secret is stored in the Raft log, which is encrypted.
Secrets are explicitly removed when a container stops.
See also
Claims
- id: C1 claim: Secrets are encrypted in transit and at rest in a swarm. source: S1 evidence: "Secrets are encrypted during transit and at rest in a Docker swarm."
- id: C2 claim: Configs are the supported store for non-sensitive data. source: S1 evidence: "Docker supports the use of configs for storing non-sensitive data."
- id: C3 claim: The secret is stored in the encrypted Raft log. source: S2 evidence: "The secret is stored in the Raft log, which is encrypted."
- id: C4 claim: Secrets are removed when a container stops. source: S2 evidence: "the secrets are explicitly removed when a container stops"
Sources
- [S1] Manage sensitive data with Docker secrets. Docker, Inc.. https://docs.docker.com/engine/swarm/secrets/ . License: Apache License 2.0. Accessed 2026-11-26.
- [S2] Manage sensitive data with Docker secrets (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/secrets.md . License: Apache License 2.0. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Manage sensitive data with Docker secrets; Docker, Inc., Manage sensitive data with Docker secrets (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Manage sensitive data with Docker secrets; Docker, Inc., Manage sensitive data with Docker secrets (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "Docker Swarm secrets: share sensitive data with running services." iinventedlight Library, iil:note:znq3jkej, version of 2026-11-26. https://iinventedlight.com/library/notes/docker-swarm-secrets/. License: CC-BY-4.0.
@misc{iil_note_znq3jkej,
author = {{iinventedlight}},
title = {{Docker Swarm secrets: share sensitive data with running services}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/docker-swarm-secrets/},
note = {Permanent ID iil:note:znq3jkej. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- docker-swarm-secrets.schema.json (schema; CC-BY-4.0)
- docker-swarm-secrets.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-swarm-secrets.md.