Docker Desktop "Mounts denied: path is not shared" in CI/Local
Docker Desktop (macOS/Windows) only allows bind mounts from paths on its file-sharing list. A mount from a directory outside that list is rejected with "Mounts denied: path is not shared".
What this error means
A docker run -v or compose bind mount fails to start with Mounts denied: The path /some/dir is not shared from the host and is not known to Docker. The same compose file works on a Linux runner where there is no file-sharing gate.
docker: Error response from daemon: Mounts denied:
The path /Users/ci/work/data is not shared from the host and is not known to Docker.Common causes
Bind source outside Docker Desktop’s shared paths
Docker Desktop on macOS/Windows mediates host file access. Only configured shared directories (and their subpaths) can be bind-mounted; anything else is denied.
A macOS/Windows-only assumption in a Linux pipeline
A compose file mounting an absolute host path that exists on Linux runners fails on a Docker Desktop machine where that path is not shared.
How to fix it
Add the path to Docker Desktop file sharing
- Open Docker Desktop → Settings → Resources → File sharing.
- Add the parent directory of the bind source, then apply & restart.
- Re-run the container so the now-shared path mounts.
Mount a relative path under the project, or use a named volume
Keep bind sources inside the (already shared) project directory, or avoid host binds with a named volume.
# relative to the project (typically already shared):
docker run -v "$PWD/data:/data" myorg/api
# or a named volume that needs no host sharing:
docker volume create appdataHow to prevent it
- Keep bind-mount sources inside the project directory for cross-platform CI.
- Add required directories to Docker Desktop file sharing on dev machines.
- Prefer named volumes over absolute-path host binds where the host path may differ.