Fixing the Docker 'Mounts denied' Error: A Guide to File Sharing

beginner🐳 Docker2026-06-29| Docker Desktop on macOS (Intel/Apple Silicon) or Windows (Hyper-V backend)

Error Message

Error response from daemon: Mounts denied: The path /Users/project is not shared from the host and is not known to Docker.
#docker-desktop#volume#macos#file-sharing#mount

The ScenarioWe’ve all been there: you’re ready to start coding, you run docker-compose up, and everything grinds to a halt. I hit this wall recently while mapping a custom source code directory to a container using the -v flag. Instead of a running environment, I got a blunt error message in my terminal:

docker: Error response from daemon: Mounts denied: 
The path /Users/project is not shared from the host and is not known to Docker. 
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.

This roadblock pops up because Docker Desktop doesn't have an all-access pass to your hard drive. Since it runs inside a lightweight virtual machine (VM), it operates within a restricted sandbox for security. If you try to mount a directory outside of Docker's "safe list," the engine blocks the request to protect your system.

Why This HappensDocker Desktop needs explicit permission to touch folders on your host machine. Out of the box, it usually trusts common paths like /Users, /Volumes, /private, and /tmp on macOS. However, if your project lives in a custom location—perhaps a dedicated /Data partition or a specific root folder—Docker will deny the mount to prevent unauthorized file access by a container.

The Quick Fix: Moving the ProjectIf you're in a rush, the fastest workaround is to move your project folder into a path Docker already trusts. On a Mac, dragging your folder into /Users/yourusername/ usually fixes the issue instantly. This works because /Users is shared by default in almost every Docker Desktop installation.

The Permanent Fix: Configuring File SharingYou shouldn't have to change your entire workflow just for a mount. To keep your project exactly where it is, follow these steps to authorize the path:

Step 1: Open Docker Desktop SettingsClick the Docker whale icon in your menu bar (macOS) or system tray (Windows). Select Settings. If you are running a version older than 4.0, this might still be labeled Preferences.

Step 2: Navigate to File SharingLook at the sidebar and head to Resources, then click the File Sharing tab. You’ll see a list of directories that the Docker VM is currently allowed to access.

Step 3: Add Your Custom PathClick the + (plus) button. Browse to your project directory, such as /Users/project, or select a parent folder that holds all your dev work. Click Open to add it to the list.

Step 4: Apply and RestartClick the Apply & Restart button. Docker will reboot its internal engine to load the new permissions. This usually takes about 30 to 60 seconds depending on your hardware.

Verifying the FixAfter Docker finishes its reboot, test the mount with a lightweight container. Run this command in your terminal:

docker run --rm -v /Users/project:/app alpine ls /app

If you see your local files listed instead of an error, you're good to go.

Troubleshooting File Sync IssuesSometimes the mount works, but changes don't sync instantly. This is usually down to the file-sharing implementation. Docker Desktop 4.6 and later introduced VirtioFS for macOS, which offers much better performance than the older gRPC FUSE.

If you suspect your files aren't mirroring correctly, try comparing hashes. I use the Hash Generator on ToolCraft to create an MD5 or SHA-256 hash of a config file on my host. Then, I run md5sum inside the container. If the strings match, the sync is perfect. It’s a 10-second check that beats guessing every time.

A Note for Windows UsersUsing Windows with the WSL 2 backend? You’ll notice the "File Sharing" tab is missing entirely. This is because WSL 2 manages file access through the Linux kernel. If you get a mount error here, it’s likely because you’re mounting a Windows path (like C:\Projects) into a Linux container. For a 2x to 5x performance boost, move your files directly into the WSL filesystem, such as \\wsl$\Ubuntu\home\user\project.

Summary Checklist- Is the exact path (or its parent) listed in Docker Settings > Resources > File Sharing?- Did you click "Apply & Restart"?- On macOS Ventura or Sonoma, does Docker have "Full Disk Access" in System Settings?- Are you using a relative path in a script that resolves to a restricted directory?

Related Error Notes