Progrider

Programming discussion

Board index
Help · ✓ Resolved

docker ate 60GB of my 80GB disk

VPS started failing writes. du says most of it is /var/lib/docker. I only have four containers! How do I find out what it is and what's safe to delete?

6 replies

docker system df -v to see the breakdown. Usual suspects are old images from rebuilds, build cache, and container logs. The logs are in /var/lib/docker/containers/*/*-json.log and by default they grow forever.
31GB of log for one container. wow.
daemon.json: { "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" } } Only applies to containers created after you restart the daemon, so recreate them. For now truncate -s 0 the file. Don't rm it while the container's running, the space won't come back until the file handle closes.
docker system prune -a removes all images not used by a running container. Leave out --volumes unless you've read what that does. People have lost databases.
Or don't use docker.
Down to 12GB, and the logging's capped now. Thanks.

Discussion resolved

This discussion is resolved. Its creator can reopen it to accept more replies.