This error occurs when Docker's devicemapper thin pool runs out of free data blocks. The fix involves cleaning up unused Docker resources, extending the thin pool, or migrating to the overlay2 storage driver.
The "Thin Pool has free data blocks which is less than minimum required" error occurs when using Docker with the devicemapper storage driver. Docker maintains a minimum free space threshold in the thin pool to ensure safe operation. When free data blocks fall below this threshold, Docker prevents new operations to avoid data corruption. The devicemapper driver uses Linux's device mapper thin provisioning (dm-thinp) module to implement copy-on-write snapshots for container storage. Each time you pull an image or create a container, Docker creates thin devices within the pool. Over time, these accumulate and consume the available space. This error is particularly common on RHEL/CentOS systems and older Docker installations where devicemapper was the default storage driver. The error can block container creation, image pulls, and other Docker operations until space is freed or the pool is expanded.
First, examine the current state of your thin pool:
docker info | grep -A 20 "Storage Driver"Look for these key values:
- Data Space Used / Data Space Total: How much of the thin pool is consumed
- Thin Pool Minimum Free Space: The threshold that triggers this error
Also check LVM thin pool status directly:
sudo lvsThis shows the data percentage used for each logical volume.
Remove unused containers, images, and volumes to free space:
# Remove stopped containers
docker container prune -f
# Remove unused images
docker image prune -a -f
# Remove unused volumes
docker volume prune -f
# Or clean everything at once
docker system prune -a --volumes -fNote: On some systems with devicemapper issues, pruning may not immediately recover thin pool space. You may need to restart Docker after pruning:
sudo systemctl restart dockerIf pruning doesn't recover space due to orphaned layers, try saving active images and reloading them:
# Save important images to tar files
docker save -o myapp.tar myapp:latest
# Remove all images
docker rmi $(docker images -q) -f
# Reload the images you need
docker load -i myapp.tarThis creates fresh image layers without orphaned data.
If your volume group has free space, extend the thin pool:
# Check available space in the volume group
sudo vgs
# Extend the thin pool (adjust the path based on your setup)
sudo lvextend -l+100%FREE /dev/docker/thinpoolIf the thin pool name is different, find it with:
sudo lvs -a | grep poolAfter extending, verify Docker recognizes the new space:
docker info | grep "Data Space"Enable automatic thin pool extension to prevent future issues. Create or edit the LVM profile:
sudo vi /etc/lvm/profile/docker-thinpool.profileAdd these settings:
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}This extends the pool by 20% when usage reaches 80%. Apply the profile:
sudo lvchange --metadataprofile docker-thinpool docker/thinpoolAs a temporary fix, you can lower the minimum free space threshold:
sudo systemctl stop dockerEdit or create /etc/docker/daemon.json:
{
"storage-opts": [
"dm.min_free_space=5%"
]
}Restart Docker:
sudo systemctl start dockerWarning: Lowering this threshold too much risks thin pool exhaustion and potential data corruption. Use this only as a temporary measure while implementing a permanent fix.
The devicemapper driver is deprecated. Migrating to overlay2 provides better performance and avoids thin pool issues:
Warning: This process removes all existing images and containers. Back up important data first.
# Stop Docker
sudo systemctl stop docker
# Back up Docker data (optional)
sudo cp -au /var/lib/docker /var/lib/docker.backup
# Remove old Docker data
sudo rm -rf /var/lib/docker
# Configure overlay2 in daemon.json
sudo vi /etc/docker/daemon.jsonSet the storage driver:
{
"storage-driver": "overlay2"
}Start Docker:
sudo systemctl start docker
docker info | grep "Storage Driver"You'll need to re-pull all images after migration.
Understanding thin pool architecture: Docker's devicemapper driver creates a thin pool with two components: a data volume for actual storage and a metadata volume for tracking allocations. Both can run out of space independently. Check both with sudo lvs -a.
Loopback vs direct-lvm: Loopback mode uses sparse files that can grow up to a fixed limit, while direct-lvm uses actual block devices. Loopback is easier to set up but has significant performance and reliability limitations. For production, always use direct-lvm or migrate to overlay2.
AWS/Cloud environments: On AWS Elastic Beanstalk, Docker environments provision a separate 12GB xvdcz volume for image storage by default. Customize this with BlockDeviceMapping configuration if you need more space.
RHEL/CentOS specific notes: Older versions defaulted to devicemapper. RHEL 7.4+ and CentOS 7.4+ support overlay2 with kernel 3.10.0-693 or later. Check compatibility with cat /proc/filesystems | grep overlay.
Recovery from severe thin pool exhaustion: If the thin pool is completely full (0 free blocks), you may need to:
1. Add a new physical volume to the volume group: sudo pvcreate /dev/sdX && sudo vgextend docker /dev/sdX
2. Then extend the thin pool
3. Or delete the Docker data directory entirely and start fresh
Monitoring: Set up monitoring for thin pool usage to catch issues before they cause failures:
# Add to crontab or monitoring system
lvs --noheadings -o data_percent docker/thinpoolunable to configure the Docker daemon with file /etc/docker/daemon.json
How to fix 'unable to configure the Docker daemon with file daemon.json' in Docker
docker: Error response from daemon: OCI runtime create failed: container_linux.go: starting container process caused: exec: "/docker-entrypoint.sh": stat /docker-entrypoint.sh: no such file or directory
How to fix 'exec: entrypoint.sh: no such file or directory' in Docker
image operating system "linux" cannot be used on this platform
How to fix 'image operating system linux cannot be used on this platform' in Docker
dockerfile parse error line 5: unknown instruction: RRUN
How to fix 'unknown instruction' Dockerfile parse error in Docker
manifest unknown: manifest unknown
How to fix 'manifest unknown' in Docker