How to fix Error response from daemon: failed to mount local volume: mount source path does not exist in Docker
This error occurs when Docker cannot mount a volume because the specified source path on the host machine does not exist. This commonly happens with bind mounts when the host directory has not been created, the path contains typos, or relative paths are used instead of absolute paths.
Quick fix
Fixes Error response from daemon: failed to mount local volume: mount source path does not exist
ls -la /path/to/your/volume- Verify the host path exists
- Use absolute paths instead of relative paths
- Check and fix directory permissions
- Handle symlinks by using real paths
ls -la /path/to/your/volumeError response from daemon: failed to mount local volume: mount source path does not exist
What this error means
When you create a container with a volume mount, Docker needs to map a directory from your host machine to a directory inside the container. This error indicates that Docker looked for the source directory on your host but could not find it. The behavior differs depending on the mount syntax you use: - With `--mount` (recommended): Docker will fail immediately with this error if the source path does not exist, alerting you to the problem before the container starts. - With `-v` or `--volume` (legacy): Docker will silently create the missing directory as an empty folder owned by root, which often leads to confusing permission issues or missing files inside the container. Docker officially recommends using `--mount` because it provides clearer error messages and more predictable behavior.
Typical symptoms
- Container fails to start with "mount source path does not exist" error
- Docker Compose services fail during startup
- Error mentions "failed to mount local volume"
- The error appears when using bind mounts with absolute or relative paths
- CI/CD pipelines fail at the container deployment step
Common causes
- The host directory specified in the volume mount does not exist
- A typo in the volume source path
- Using relative paths instead of absolute paths
- The path contains a symlink that Docker cannot resolve
- Parent directory permissions prevent Docker from accessing the path
- On Docker Desktop (Mac/Windows), the path is outside the configured shared directories
- The Docker volume was previously deleted but the container still references it
- Moving project folders without restarting Docker Desktop
How to fix "Error response from daemon: failed to mount local volume: mount source path does not exist"
First, check if the source path actually exists on your host machine:
ls -la /path/to/your/volumeIf the directory does not exist, create it:
mkdir -p /path/to/your/volumeThe -p flag creates any missing parent directories.
Docker requires absolute paths for bind mounts. Replace relative paths with absolute paths:
# Wrong - relative path
volumes:
- ./data:/app/data
# Correct - absolute path
volumes:
- /home/user/project/data:/app/dataAlternatively, use the $PWD environment variable:
volumes:
- ${PWD}/data:/app/dataOr in the command line:
docker run -v $(pwd)/data:/app/data myimageEnsure Docker can access the directory by setting appropriate permissions:
# Check current permissions
ls -la /path/to/your/volume
# Fix ownership if needed
sudo chown -R $USER:$USER /path/to/your/volume
# Set read/execute permissions
sudo chmod -R 755 /path/to/your/volumeNote: The user running Docker needs at least read and execute permissions on all parent directories in the path.
If your path contains symlinks, Docker may fail to resolve them. Use the real path instead:
# Find the real path
readlink -f /path/to/your/symlinked/volume
# Use the resolved path in your Docker command
docker run -v /actual/real/path:/app/data myimageThis is a known issue in Docker that has persisted across versions.
If the error persists after a volume directory was deleted, remove the orphaned Docker volume:
# List all volumes
docker volume ls
# Remove the specific volume
docker volume rm <volume_name>
# Or prune all unused volumes
docker volume pruneAfter pruning, recreate your container and the volumes will be reinitialized.
On Docker Desktop, volume mount issues can sometimes be resolved by restarting:
1. Click the Docker icon in your system tray
2. Select "Restart"
3. Wait for Docker to fully restart
4. Try running your container again
If problems persist, try switching the file sharing backend:
- Open Docker Desktop Settings
- Go to "General" or "Resources > File sharing"
- Try switching between VirtioFS and gRPC FUSE (macOS)
- Ensure your project directory is in a shared location
Advanced notes
Docker Desktop Virtual Machine Limitations
On macOS and Windows, Docker runs inside a Linux virtual machine. By default, only certain directories are shared between your host and this VM:
- macOS: /Users, /Volumes, /private, /tmp
- Windows: Typically C:\Users
If your project is outside these directories, add it to Docker Desktop's file sharing settings.
WSL2 Volume Paths
When using Docker with WSL2 on Windows, volume paths need special handling:
- Access Windows files via /mnt/c/Users/...
- For better performance, keep project files inside the WSL filesystem at ~/projects/...
- Docker volumes are stored at: /mnt/wsl/docker-desktop-data/data/docker/volumes
Using Named Volumes vs Bind Mounts
If you do not need to access files from the host, consider using named volumes instead of bind mounts:
volumes:
mydata:
services:
app:
volumes:
- mydata:/app/dataNamed volumes are managed by Docker, automatically created, and do not have path existence issues.
Debugging with docker inspect
Use docker inspect to verify volume mounts on a running container:
docker inspect <container_id> --format '{{json .Mounts}}' | jqFrequently asked questions
- What does "Error response from daemon: failed to mount local volume: mount source" mean?
- When you create a container with a volume mount, Docker needs to map a directory from your host machine to a directory inside the container. This error indicates that Docker looked for the source directory on your host but could not find it. The behavior differs depending on the mount syntax you use: - With --mount (recommended): Docker will fail immediately with this error if the source path does not exist, alerting you to the problem before the container starts.
- How do I fix "Error response from daemon: failed to mount local volume: mount source"?
- This error occurs when Docker cannot mount a volume because the specified source path on the host machine does not exist. This commonly happens with bind mounts when the host directory has not been created, the path contains typos, or relative paths are used instead of absolute paths.
- What causes "Error response from daemon: failed to mount local volume: mount source"?
- The host directory specified in the volume mount does not exist A typo in the volume source path Using relative paths instead of absolute paths
- Is the "Error response from daemon: failed to mount local volume: mount source" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Docker Official Documentation
- ๐ฌDocker volume mount doesn't exist - Stack Overflow(Stack Overflow)
- ๐ฌDocker failed to mount local volume - Stack Overflow(Stack Overflow)
- ๐Bind mounts - Docker Docs(Official Docs)
- ๐Volumes - Docker Docs(Official Docs)
- ๐Troubleshooting volume errors - Docker Docs(Official Docs)
- ๐
- ๐