How to fix Mounts denied: The path /host/path is not shared from the host and is not known to Docker in Docker

DockerBEGINNERMEDIUMUpdated Dec 6, 2025ยท 314 views

This error occurs when Docker Desktop cannot access a host directory you're trying to mount. The path must be added to Docker's file sharing settings before it can be used as a bind mount.

Quick fix

Fixes Mounts denied: The path /host/path is not shared from the host and is not known to Docker

# Check your docker run command
docker run -v /path/to/mount:/container/path myimage

# Or check docker-compose.yml for volume definitions
cat docker-compose.yml | grep -A 5 volumes
  1. Verify the exact path causing the error
  2. Open Docker Desktop file sharing settings
  3. Add the required directory to shared folders
  4. Wait for Docker to restart and retry
docker โ€” error
# Check your docker run command
docker run -v /path/to/mount:/container/path myimage
# Or check docker-compose.yml for volume definitions
cat docker-compose.yml | grep -A 5 volumes
Mounts denied: The path /host/path is not shared from the host and is not known to Docker

What this error means

Docker Desktop on macOS and Windows runs containers inside a lightweight virtual machine. For security reasons, Docker does not automatically grant containers access to all directories on your host system. Only specific directories that have been explicitly shared with Docker can be mounted into containers. When you try to mount a directory that isn't in Docker's allowed list, you'll see this error. The message "The path /host/path is not shared from the host and is not known to Docker" means the directory you specified in your `-v` or `--mount` flag hasn't been configured as a shared folder in Docker Desktop settings. By default, Docker Desktop shares common directories like `/Users`, `/Volumes`, `/private`, `/tmp`, and `/var/folders` on macOS, and your user's home directory on Windows. Paths outside these defaults require manual configuration.

Typical symptoms

  • Docker run or docker-compose up fails with 'Mounts denied' error
  • Error message mentions 'path is not shared from the host'
  • Volume mounts work for some directories but not others
  • The error appears after moving a project to a new location
  • CI/CD pipelines fail when running Docker on macOS or Windows build agents
  • Containers that previously worked fail after Docker Desktop update

Common causes

  1. The host path is outside Docker Desktop's default shared directories
  2. File sharing settings were reset after a Docker Desktop update
  3. The path contains symlinks that resolve outside shared directories
  4. Docker Desktop is using VirtioFS or gRPC FUSE with restricted access
  5. The directory path has incorrect case sensitivity (especially on macOS)
  6. You're using a path that requires elevated permissions
  7. Docker Desktop's file sharing feature is disabled or misconfigured

How to fix "Mounts denied: The path /host/path is not shared from the host and is not known to Docker"

1Verify the exact path causing the error

First, identify the full path Docker is trying to mount. Check your docker command or docker-compose.yml:

bash
# Check your docker run command
docker run -v /path/to/mount:/container/path myimage

# Or check docker-compose.yml for volume definitions
cat docker-compose.yml | grep -A 5 volumes

On macOS, if the path includes symlinks, resolve them:

bash
realpath /path/to/your/directory

The resolved path is what Docker actually tries to access.

2Open Docker Desktop file sharing settings

Navigate to Docker Desktop's file sharing configuration:

On macOS:
1. Click the Docker whale icon in the menu bar
2. Select "Preferences..." (or "Settings...")
3. Go to Resources > File Sharing

On Windows:
1. Right-click the Docker whale icon in the system tray
2. Select "Settings"
3. Go to Resources > File Sharing

Note: On Windows with WSL2 backend, file sharing is automatic for paths inside WSL distributions. The File Sharing tab only appears in Hyper-V mode.

3Add the required directory to shared folders

Add your directory (or a parent directory) to Docker's file sharing list:

1. In the File Sharing settings, click the + button
2. Browse to and select the directory you need to mount
3. Click Apply & Restart

Tips:
- Share a parent directory (like /data) rather than individual subdirectories
- Avoid sharing your entire root filesystem for security reasons
- On macOS, sharing /usr/local may require additional permissions

4Wait for Docker to restart and retry

After applying file sharing changes, Docker Desktop will restart:

1. Wait for the Docker whale icon to stop animating
2. Verify Docker is running:

bash
docker info

3. Retry your original command:

bash
docker run -v /your/shared/path:/container/path myimage
5Handle symlink issues (macOS)

macOS uses symlinks in several system paths. Docker needs both the symlink and the real path shared.

For example, /var is symlinked to /private/var:

bash
ls -la /var
# lrwxr-xr-x  1 root  wheel  11 Jan  1  2020 /var -> private/var

Solution: Add both paths to file sharing:
- /var/folders
- /private/var/folders

Or use the resolved path in your Docker command:

bash
docker run -v "$(realpath /var/folders/xx/path):/container/path" myimage
6Move project to an already-shared directory

If adding custom paths doesn't work or isn't possible, move your project to a default shared location:

On macOS (default shared paths):
- /Users (your home directory)
- /Volumes
- /private
- /tmp

On Windows:
- Your user profile folder (C:\Users\YourName)

Example:

bash
# Move project to home directory
mv /custom/project ~/Projects/my-project
cd ~/Projects/my-project
docker-compose up
7Try switching file sharing backend (macOS)

If you're experiencing persistent issues after a Docker Desktop update, try changing the file sharing backend:

1. Open Docker Desktop Preferences
2. Go to General
3. Find the file sharing implementation option
4. Try switching between:
- VirtioFS (faster, recommended)
- gRPC FUSE (more compatible)
- osxfs (Legacy) (older, slower but most compatible)
5. Click Apply & Restart

Some users report that switching from VirtioFS to gRPC FUSE resolves file sharing issues after updates.

8Reset Docker Desktop file sharing (last resort)

If file sharing settings appear corrupted, reset them:

1. Open Docker Desktop Preferences
2. Go to Troubleshoot (or click the bug icon)
3. Click Reset to factory defaults

Warning: This removes all containers, images, volumes, and settings.

Alternatively, reset only the settings file:

On macOS:

bash
rm ~/Library/Group\ Containers/group.com.docker/settings.json

On Windows:

powershell
Remove-Item "$env:APPDATA\Docker\settings.json"

Then restart Docker Desktop and reconfigure file sharing.

Advanced notes

Case sensitivity on macOS:
macOS uses a case-insensitive filesystem by default. Docker may fail to mount paths with incorrect case. For example, /Volumes works but /volumes may not.

Windows with WSL2:
When using Docker Desktop with WSL2 backend, file sharing works differently:
- Paths within WSL distributions (\\wsl$\Ubuntu\...) are automatically available
- Windows paths (C:\Users\...) are accessible via /mnt/c/Users/... inside containers
- The File Sharing settings page is hidden in WSL2 mode since it's not needed

Docker Context and Remote Hosts:
This error only affects Docker Desktop. If you're using Docker Engine on a Linux server, bind mounts work without file sharing configuration since there's no VM layer.

SELinux and Security (Linux Docker Engine):
On Linux with SELinux enabled, mount errors may look similar but have a different cause. Use the :z or :Z suffix:

bash
docker run -v /host/path:/container/path:z myimage

Performance Considerations:
Shared directories have performance overhead due to the virtualization layer. For large projects with many files, consider:
- Using named volumes instead of bind mounts for dependencies (node_modules, vendor)
- Enabling experimental file caching options in Docker Desktop
- Keeping frequently-accessed files in default shared paths

Frequently asked questions

What does "Mounts denied: The path /host/path is not shared from the host and is" mean?
Docker Desktop on macOS and Windows runs containers inside a lightweight virtual machine. For security reasons, Docker does not automatically grant containers access to all directories on your host system. Only specific directories that have been explicitly shared with Docker can be mounted into containers.
How do I fix "Mounts denied: The path /host/path is not shared from the host and is"?
This error occurs when Docker Desktop cannot access a host directory you're trying to mount. The path must be added to Docker's file sharing settings before it can be used as a bind mount.
What causes "Mounts denied: The path /host/path is not shared from the host and is"?
The host path is outside Docker Desktop's default shared directories File sharing settings were reset after a Docker Desktop update The path contains symlinks that resolve outside shared directories
Is the "Mounts denied: The path /host/path is not shared from the host and is" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading