# 守护进程响应错误：mkdir /var/lib/docker/overlay2/...：设备上没有剩余空间

- **ID:** `docker/overlay2-quota-exceeded`
- **领域:** docker
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

overlay2 文件系统的 inode 或块配额已耗尽，通常是由于过多的容器层或悬空镜像占用了所有可用空间。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Docker 20.10.0 | active | — | — |
| Docker 24.0.0 | active | — | — |
| Docker 25.0.0 | active | — | — |
| Docker CE 26.0.0 | active | — | — |

## 解决方案

1. ```
   Run 'docker system prune --all --volumes' to remove unused containers, networks, images, and volumes. Then verify with 'df -h /var/lib/docker' and 'df -i /var/lib/docker'.
   ```
2. ```
   Increase the overlay2 storage quota by editing /etc/docker/daemon.json: add '{"storage-opts": ["overlay2.size=100G"]}' and restart Docker. Note: this works only with xfs filesystem and project quotas enabled.
   ```

## 无效尝试

- **** — Running 'docker system prune -a' without checking for running containers can remove essential images and containers, causing data loss. (40% 失败率)
- **** — Increasing overlay2 size via daemon.json 'storage-opts' often fails because the underlying filesystem (e.g., ext4) does not support per-directory quotas. (60% 失败率)
- **** — Rebooting the host only temporarily frees space if the root cause (e.g., log rotation) is not addressed. (70% 失败率)
