Cloud Computing

Docker image pulls fail with 'no space left on device' though df shows plenty of disk — overlayfs inode exhaustion on Ubuntu 22.04

pixelpelle
1mo ago
Environment

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

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

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

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

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?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
oscaronline Answer
user
Posted 1mo ago • 0 confirmations

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.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 1mo ago• Trouble ID

Most likely causes

Ext4 filesystem inode exhaustion on partition hosting /var/lib/docker due to many small files created by overlay2 95%
Overlay2 leak where deleted files remain due to running containers or lingering mounts preventing inode reclamation 40%
Daemon or orchestration bug repeatedly writing tiny metadata files (rare Docker bug or garbage collector misbehavior) 15%

Summary

Error is due to running out of inodes on ext4: many small files from overlay2 consume inodes even if byte space remains. Temporary cleanup helps but recurrence is expected on churny CI. Long-term solutions: reformatting to a FS with more inodes (mkfs.ext4 with higher -i or use XFS), reduce layer/file churn by using slimmer images and build caches, or move Docker graph root to a separate partition with larger inode capacity.

Suggested Fixes

Diagnostic step 1
Confirm inode exhaustion: df -i /var/lib/docker and ls -lah /var/lib/docker/overlay2 | wc -l to estimate entries.
Diagnostic step 2
Short-term: schedule maintenance window, stop docker.service, move /var/lib/docker to a larger partition (rsync -a), update /etc/docker/daemon.json {"data-root":"/mnt/docker"}, restart daemon. Verify by docker pull.
Diagnostic step 3
Medium-term: rebuild filesystem with larger inode density (mkfs.ext4 -i smaller_bytes_per_inode) or migrate to XFS on a new partition. Test on a non-prod runner first.

Continue troubleshooting

Matched from the title, description and tags