How to fix failed to register layer: Error processing tar file(exit status 1): no space left on device in Docker
Docker has run out of disk space for images, containers, or volumes. Clean up unused Docker resources with docker system prune or expand your disk storage.
Quick fix
Fixes ENOSPC
docker system df- Check Docker disk usage
- Remove unused containers, networks, and images
- Remove specific unused images
- Clean up build cache
docker system dffailed to register layer: Error processing tar file(exit status 1): no space left on device
What this error means
This error indicates that Docker cannot write data because the disk partition where Docker stores its data is full. Docker stores images, containers, volumes, and build cache in a data directory (typically `/var/lib/docker` on Linux). Over time, unused images, stopped containers, and dangling volumes accumulate and consume significant disk space. This is especially common in CI/CD environments or development machines where many images are pulled and built.
Typical symptoms
- docker pull fails when downloading image layers
- docker build fails during COPY or RUN instructions
- Container creation fails with space-related errors
- docker run fails immediately after starting
- Build cache operations fail unexpectedly
Common causes
- Accumulated unused Docker images consuming disk space
- Stopped containers not removed (each keeps a writable layer)
- Dangling volumes from deleted containers
- Large build cache from repeated docker build operations
- Docker data directory on a small partition
- Log files from containers growing unbounded
- Underlying filesystem is genuinely full (not just Docker)
How to fix "failed to register layer: Error processing tar file(exit status 1): no space left on device"
First, see how much space Docker is using:
docker system dfThis shows space used by images, containers, volumes, and build cache. The "RECLAIMABLE" column shows how much can be freed.
Clean up all unused Docker resources:
# Remove stopped containers, unused networks, dangling images
docker system prune
# Include unused volumes (careful - data loss possible)
docker system prune --volumes
# Remove ALL unused images, not just dangling ones
docker system prune -aWarning: --volumes removes volumes not attached to containers. Ensure you don't need that data.
If you want more control, remove images selectively:
# List all images with sizes
docker images -a
# Remove specific image
docker rmi <image_id>
# Remove all dangling images
docker image prune
# Remove images older than 24 hours
docker image prune -a --filter "until=24h"Build cache can grow very large with repeated builds:
# Remove all build cache
docker builder prune
# Remove build cache older than 24 hours
docker builder prune --filter "until=24h"
# See build cache usage
docker system df --verboseVerify the underlying disk has space:
df -h /var/lib/dockerIf the partition is nearly full even after Docker cleanup, you may need to expand the disk or move Docker's data directory.
If /var/lib/docker is on a small root partition, move it:
# Stop Docker
sudo systemctl stop docker
# Edit Docker daemon config
sudo nano /etc/docker/daemon.jsonAdd:
{
"data-root": "/path/to/new/docker-data"
}Then move the data and restart:
sudo mv /var/lib/docker /path/to/new/docker-data
sudo systemctl start dockerAdvanced notes
Container Log Limits: Container logs can grow unbounded. Set limits in daemon.json:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}Automated Cleanup: Consider running docker system prune -f in a daily cron job on CI/CD runners.
Docker Desktop: On macOS/Windows, Docker Desktop uses a virtual disk that can be resized in Settings โ Resources โ Disk image size.
Frequently asked questions
- What does "ENOSPC" mean?
- This error indicates that Docker cannot write data because the disk partition where Docker stores its data is full. Docker stores images, containers, volumes, and build cache in a data directory (typically /var/lib/docker on Linux). Over time, unused images, stopped containers, and dangling volumes accumulate and consume significant disk space.
- How do I fix "ENOSPC"?
- Docker has run out of disk space for images, containers, or volumes. Clean up unused Docker resources with docker system prune or expand your disk storage.
- What causes "ENOSPC"?
- Accumulated unused Docker images consuming disk space Stopped containers not removed (each keeps a writable layer) Dangling volumes from deleted containers
- Is the "ENOSPC" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐Docker Official Documentation
- ๐ฌStack Overflow Discussion(Stack Overflow)
- ๐