Docker Compose
Compose secrets
Provide a file to selected services; Linux short syntax exposes it below /run/secrets. Local file-backed mounts do not guarantee encrypted storage or automatic rotation. Never print real values. A successful absence check is limited to the inspected path and service.
Formal Syntax & Structure
docker syntaxdocker
secrets: { NAME: { file: PATH } }Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| NAME | string | Secret identifier |
| PATH | string | Authorized source file |
Working Example
Example Snippetdocker
secrets: demo_token: file: ./demo-token.txt