Skip to main content
In Docker, logging drivers determine how container and service logs are captured, formatted, and stored. By choosing the right logging driver, you can centralize logs, integrate with external systems, and manage log retention efficiently. You can always view a container’s output with:
but behind the scenes the logging driver dictates where and how those logs are persisted.
The image features the text "Logging Drivers" on a dark background with abstract circular shapes and a wavy purple and blue design at the bottom.

What Is the Default json-file Logging Driver?

Docker’s default logging driver is json-file. It collects container output and writes it as JSON objects on the host filesystem. To confirm your daemon’s default driver:
Look for:
Run and inspect logs under json-file:
Sample output:

Where Are json-file Logs Stored?

By default, log files are stored under /var/lib/docker/containers/<container-id>. Each container directory contains a file named <container-id>-json.log:
Rotating or cleaning up old JSON logs prevents disk exhaustion. Consider using Docker’s log-opts settings like max-size and max-file.

Supported Docker Logging Drivers

Beyond json-file, Docker integrates with multiple logging backends. Choose the one that matches your infrastructure for centralized log aggregation:
Using the none driver disables all logs for the container. Only use this when you intentionally want zero log output.

Changing the Daemon’s Default Logging Driver

To set a different default logging driver, modify (or create) /etc/docker/daemon.json:
If you need TLS, custom hosts, or debug mode, include those settings alongside:
Restart Docker to apply changes:

Overriding the Logging Driver Per Container

You can override the daemon default for individual containers with the --log-driver flag:
Add driver-specific options via --log-opt:

Inspecting a Container’s Logging Configuration

To verify which logging driver a container is using:
Search for the HostConfig.LogConfig section:
For a concise output with a Go template:
This prints only the driver name.

Watch Video