# 来自守护进程的错误响应：创建 overlay 挂载到 /var/lib/docker/overlay2/... 时出错：无效参数

- **ID:** `docker/overlay2-mount-invalid-argument`
- **领域:** docker
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

Docker 存储后端文件系统（如未启用 'overlay' 特性的 ext4 或缺少 'd_type' 支持的 XFS）不支持 overlay2 驱动要求。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Docker 25.0.3 | active | — | — |
| Linux 6.1.0 | active | — | — |
| ext4 1.46.5 | active | — | — |

## 解决方案

1. ```
   检查文件系统支持：运行 'mount | grep overlay'，并在 XFS 上使用 'xfs_info /var/lib/docker' 验证 'd_type' 是否启用。如果缺失，使用 'mkfs.xfs -n ftype=1 /dev/sdX' 重新格式化分区（需先备份）。
   ```
2. ```
   临时切换到 'vfs' 存储驱动，在 /etc/docker/daemon.json 中添加 '{"storage-driver":"vfs"}' 并重启 Docker。注意：VFS 会占用更多磁盘空间。
   ```

## 无效尝试

- **Reinstall Docker completely** — Reinstallation does not change the underlying filesystem configuration; the mount error persists. (90% 失败率)
- **Change storage driver to 'devicemapper' via daemon.json** — Devicemapper is deprecated and may cause other errors; also requires loop device setup. (60% 失败率)
- **Run 'docker system prune -a' to clean storage** — Pruning removes data but does not fix the filesystem incompatibility for new mounts. (75% 失败率)
