Plainnotes

Container logs filling the disk

2026-10-20 · 2 min readDeploy

/var/lib/docker grew by tens of gigabytes overnight, and du pointed at containers/*/*-json.log. Docker's json-file driver has no size limit by default.

Do not delete the file: the process holds it open and the space will not come back. Truncate instead:

truncate -s 0 /var/lib/docker/containers/<id>/<id>-json.log

The durable fix is a daemon default in /etc/docker/daemon.json:

{"log-driver":"json-file","log-opts":{"max-size":"50m","max-file":"3"}}

Reloading docker applies it to new containers only; existing ones must be recreated or started with --log-opt.