Error response from daemon: error while mounting volume '/host_mnt/c/Users/user/data': permission denied
ID: docker/volume-mount-permission-denied-windows
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Docker Desktop 4.19.0 | active | — | — | — |
| Docker Desktop 4.22.1 | active | — | — | — |
| Windows 10 21H2 | active | — | — | — |
| Windows 11 22H2 | active | — | — | — |
Root Cause
On Docker Desktop for Windows, bind mounts from the C drive require shared drive permissions; if the drive is not shared or the user lacks access, mounting fails with permission denied.
generic中文
在适用于 Windows 的 Docker Desktop 上,从 C 盘进行的绑定挂载需要共享驱动器权限;如果驱动器未共享或用户无访问权限,挂载将失败并返回权限被拒绝。
Official Documentation
https://docs.docker.com/desktop/settings/windows/#file-sharingWorkarounds
-
85% success Share the C drive in Docker Desktop: Settings > Resources > File Sharing > add 'C:\' and apply. Then restart Docker Desktop and retry the mount.
Share the C drive in Docker Desktop: Settings > Resources > File Sharing > add 'C:\' and apply. Then restart Docker Desktop and retry the mount.
-
75% success Move your project folder to a drive that is already shared (e.g., D:\) or to the user profile directory under C:\Users\ which is often shared by default.
Move your project folder to a drive that is already shared (e.g., D:\) or to the user profile directory under C:\Users\ which is often shared by default.
-
70% success Use a named volume instead of a bind mount: 'docker volume create mydata' and then 'docker run -v mydata:/app/data' to avoid host filesystem permission issues.
Use a named volume instead of a bind mount: 'docker volume create mydata' and then 'docker run -v mydata:/app/data' to avoid host filesystem permission issues.
中文步骤
在 Docker Desktop 中共享 C 盘:设置 > 资源 > 文件共享 > 添加 'C:\' 并应用。然后重启 Docker Desktop 并重新尝试挂载。
将项目文件夹移动到已共享的驱动器(例如 D:\)或默认共享的用户配置文件目录 C:\Users\ 下。
使用命名卷代替绑定挂载:'docker volume create mydata' 然后 'docker run -v mydata:/app/data' 以避免主机文件系统权限问题。
Dead Ends
Common approaches that don't work:
-
Running Docker Desktop as Administrator
70% fail
Even as Administrator, the C drive must be explicitly shared in Docker Desktop settings; admin privileges alone do not bypass the sharing requirement.
-
Changing file permissions on the host folder using icacls
80% fail
Docker Desktop uses a virtual filesystem (gRPC FUSE) to mount Windows paths; host NTFS permissions are not the primary issue—the Docker service itself needs share access.
-
Using a relative path instead of absolute path in docker run -v
60% fail
Relative paths are resolved relative to the current directory, but if the resolved absolute path is still on a non-shared drive, the same error occurs.