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?
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve or delete this discussion.
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.