Docker image pulls fail with 'no space left on device' though df shows plenty of disk — overlayfs inode exhaustion on Ubuntu 22.04
Environment
Ubuntu 22.04 hosts running Docker Engine 20.10 using overlay2 storage on ext4, hosts used as CI runners repeatedly pulling and removing many small images and layers
Symptoms
docker pull errors with 'no space left on device' when writing layer metadata; df -h shows 40GB free on root. lsof shows docker processes, journalctl shows overlayfs errors like 'no space left on device' while inode counts are near zero according to df -i.
Observations
df -i reports very low free inodes on /var/lib/docker/overlay2. The environment performs many short-lived ephemeral image operations; daemon prune happened but issue returns. Removing dangling images frees some inodes temporarily. Filesystem is ext4 with many small files created by overlay lowerdir upperdir work/root structures.
Already attempted
Ran docker system prune -af and rm -rf /var/lib/docker/overlay2/* after stopping daemon (temporary fix). Considered switching to XFS but avoided on running CI fleet. Resizing root partition not currently possible on booted runners.
Question
What's the safe long-term fix to avoid overlayfs inode exhaustion causing docker pull failures on ext4 hosts used for high churn CI workloads, without disruptive full disk repartition or immediate migration?
Verified community troubleshooting
This is classic inode exhaustion: overlay2 creates many small files so you run out of inodes even with free bytes. Confirm with df -i /var/lib/docker. For a quick non-destructive fix, stop docker, rsync /var/lib/docker to a partition with more inodes, point Docker's data-root to the new path, and restart. Long-term, either recreate the filesystem with higher inode density or move to XFS on a dedicated disk. Also reduce image churn (smaller base images, cached layers). Verify pulls succeed and monitor df -i; rollback by pointing data-root back and restoring the original directory if needed.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Linux39% match
Linux reports 'No space left on device' while df -h shows plenty of free disk space — what is filling my filesystem?
Open1 answer - Linux33% match
Docker containers report 'no space left on device' after systemd tmpfiles cleaned /var/lib/docker metadata despite free disk space
Open1 answer - Cloud Computing25% match
Elasticsearch cluster won't relocate shards: 'disk threshold exceeded' though df -h shows free space (EC2 EBS ext4 reserved blocks suspected)
Open0 answers - Software25% match
Self-hosted GitHub Actions runners produce incomplete multi-stage Docker images after kernel update (overlay2: missing build artifacts)
Open0 answers - Cloud Computing23% match
Kubernetes nodes fail to pull container images after containerd overlay storage filled on GKE-like cluster
Open0 answers