daemon.json configures the Docker Engine itself — not a single container, but the whole host. A few options prevent the most common production incidents.
Stop disks filling up
By default, container logs grow forever. This one block is the setting people wish they had set sooner:
{
"log-driver": "json-file",
"log-opts": { "max-size": "10m", "max-file": "3" }
}
Now each container keeps at most three 10 MB log files.
Use overlay2
"storage-driver": "overlay2" is the modern default and what you want on any current kernel. Avoid legacy drivers like devicemapper.
Survive daemon restarts
"live-restore": true keeps your containers running while the Docker daemon itself restarts or upgrades — essential for zero-downtime host maintenance.
Tune concurrency
max-concurrent-downloads and max-concurrent-uploads smooth out image pulls on busy CI hosts.
Apply changes safely
- Edit
/etc/docker/daemon.json. - Validate:
dockerd --validate. - Restart:
systemctl restart docker.
A malformed daemon.json can stop Docker from starting, so always validate first.
Security notes
- Never expose the daemon over
tcp://without TLS — it is root-equivalent. - Bind
metrics-addrto127.0.0.1only.
Open the daemon.json template and ask the workspace to "cap logs at 5 files of 20MB" or "add a registry mirror", then diff the result.