DB / Docker / ENOSPC
CRITICAL
Docker No Space Left on Device
The Docker daemon or a container operation failed because the underlying filesystem has run out of available storage space or inodes.
Common Causes
- The host machine's disk or partition is full.
- Docker's dedicated storage area (e.g., /var/lib/docker) has reached its capacity limit.
- The filesystem has exhausted its available inodes, even if free disk space remains.
- The container's writable layer or a mounted volume has no free space.
How to Fix
1 Check Overall Disk Usage
Use the df command to inspect disk space and inode usage across all filesystems.
BASH
$ df -h && df -i 2 Clean Up Docker System
Remove unused Docker data: stopped containers, unused networks, dangling images, and build cache.
BASH
$ docker system prune -a --volumes 3 Check Docker Storage Usage
If using the devicemapper, overlay2, or btrfs storage driver, check Docker's specific storage consumption.
BASH
$ docker system df 4 Remove Specific Large Images/Containers
Identify and remove large, unused images or volumes contributing to the problem.
BASH
$ docker images --format "table {{.Size}}\t{{.Repository}}\t{{.Tag}}" | sort -h -r
docker volume ls --format "table {{.Name}}" 5 Increase Disk Space or Move Docker Root
For a persistent issue, add storage to the host or relocate Docker's data directory (/var/lib/docker) to a larger partition.
BASH
$ # 1. Stop Docker: sudo systemctl stop docker
# 2. Move data: sudo mv /var/lib/docker /path/to/new/location
# 3. Create symlink: sudo ln -s /path/to/new/location/docker /var/lib/docker
# 4. Restart Docker: sudo systemctl start docker