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.

