Docker logging: choose and configure a logging driver
Answer: Each Docker daemon has a default logging driver, json-file unless you change it, and the local driver is the better default when you want rotation and less disk use.
Default drivers
Docker ships several logging mechanisms, called logging drivers, to collect information from running containers and services.
Each daemon has a default driver, and every container uses that default unless you pick a different one.
The default is the json-file driver, which caches container logs as JSON internally.
You can also implement logging driver plugins.
By default no log-rotation is performed, so json-file logs can use a significant amount of disk and even exhaust it.
Docker keeps json-file without rotation as the default for backward compatibility and for cases where Docker is the runtime for Kubernetes.
In other situations the local driver is recommended, because it rotates logs by default and uses a more efficient file format.
How to configure it
Set log-driver in the daemon.json file to change the daemon default.
Options in log-opts must be provided as strings, so numeric values such as max-file go in quotes.
Existing containers do not pick up the new logging configuration automatically.
docker info reports the current default under Logging Driver.
A container can still pass different options with one or more --log-opt flags.
See also
Claims
- id: C1 claim: The default logging driver is json-file. source: S1 evidence: "The default logging driver is json-file"
- id: C2 claim: By default no log-rotation is performed, which can exhaust disk space. source: S2 evidence: "By default, no log-rotation is performed"
- id: C3 claim: The local logging driver is recommended because it rotates logs by default. source: S1 evidence: "the local logging driver is recommended as it performs log-rotation by default"
Sources
- [S1] Configure logging drivers. Docker, Inc.. https://docs.docker.com/engine/logging/configure/ . License: Apache License 2.0. Accessed 2026-11-26.
- [S2] Configure logging drivers (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/logging/configure.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., Configure logging drivers; Docker, Inc., Configure logging drivers (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., Configure logging drivers; Docker, Inc., Configure logging drivers (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "Docker logging: choose and configure a logging driver." iinventedlight Library, iil:note:14ww7ys0, version of 2026-11-26. https://iinventedlight.com/library/notes/docker-logging-configure/. License: CC-BY-4.0.
@misc{iil_note_14ww7ys0,
author = {{iinventedlight}},
title = {{Docker logging: choose and configure a logging driver}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/docker-logging-configure/},
note = {Permanent ID iil:note:14ww7ys0. 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-logging-configure.schema.json (schema; CC-BY-4.0)
- docker-logging-configure.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-logging-configure.md.