docker
system_error
ai_generated
true
docker:守护进程错误响应:挂载卷 '/host/path' 时出错:权限被拒绝
docker: Error response from daemon: error while mounting volume '/host/path': permission denied
ID: docker/volume-mount-permission-denied-on-host
88%修复率
86%置信度
1证据数
2023-11-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Docker 23.0.6 | active | — | — | — |
| Docker 24.0.2 | active | — | — | — |
根因分析
Docker 守护进程对绑定挂载中指定的主机目录缺乏读/写权限。
English
Docker daemon lacks read/write permission on the host directory specified in a bind mount.
官方文档
https://docs.docker.com/storage/bind-mounts/解决方案
-
运行 'sudo chown -R root:root /host/path' 或将权限调整为 755,以确保 Docker 守护进程(以 root 身份运行)可以访问该目录。
-
如果使用 SELinux,运行 'sudo chcon -Rt svirt_sandbox_file_t /host/path' 为 Docker 卷设置正确的上下文。
无效尝试
常见但无效的做法:
-
40% 失败
Running container with --privileged flag ignores the underlying permission issue and may cause security risks.
-
80% 失败
Changing volume path to a different directory without fixing host permissions repeats the error.