CI build agents running Docker fail with "no space left on device" while pulling images; `/var/lib/docker` is 95% full.
IntermediateTroubleshootingDisk, memory and CPU
Answer
Likely causes → Docker never cleans up on its own: old images, stopped containers, dangling layers, unused volumes and BuildKit cache pile up with every build.
Diagnose →
docker system df -v | head -40
du -sh /var/lib/docker/* | sort -h
Fix →
docker container prune -f
docker image prune -a -f --filter "until=72h"
docker builder prune -f --keep-storage 20GB
docker volume prune -f
Prevent → Run the prune as a nightly systemd timer or cron on every agent, put /var/lib/docker on its own volume so a full disk doesn't kill the OS, and prefer ephemeral agents that are recreated per job.
More on Disk, memory and CPU
The app fails to write with "No space left on device", but `df -h` shows the volume is only 40% used.Beginner`df -h` says `/` is 100% full, but `du -sh /*` only adds up to 30% of the disk.BeginnerA server shows load average 40 on 8 cores, but `top` shows CPU 60% idle and the app is crawling.BeginnerPods are being evicted with "The node was low on resource: ephemeral-storage. Container app was using 18Gi, which exceeds its request of 0."IntermediatePostgres on a VM died overnight; `dmesg` shows "Out of memory: Killed process 2314 (postgres) total-vm:..., anon-rss:...".IntermediateA Java pod keeps getting OOMKilled at its 2Gi limit, even though `-Xmx2g` is set and the heap graph never reaches 2 GB.Intermediate