Docker Error Guide: 'failed to mount local volume: no such file or directory' — Missing Bind Source
Fix Docker's 'failed to mount local volume: mount /<path>: no such file or directory' error caused by missing bind-mount source paths or bad volume device options.
- #docker
- #troubleshooting
- #errors
- #volumes
Stuck on this Docker with AI error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Overview
Docker fails to start a container when the source path for a local volume mount does not exist on the host. It appears on docker run, docker compose up, or docker start:
docker: Error response from daemon: failed to mount local volume: mount /data/myapp: no such file or directory
With a named volume that uses the local driver with a device option, the same message names the device path:
Error response from daemon: failed to mount local volume: mount /srv/nfs/myapp:/var/lib/docker/volumes/myapp/_data, flags: 0x1000: no such file or directory
The kernel returned ENOENT: the host path Docker was told to mount from does not exist. This is a source-path problem, not a permissions or disk issue.
Symptoms
- A container that uses a
localvolume with adeviceoption refuses to start. docker compose upfails on a service whose volumedevice:path is missing.- The volume exists in
docker volume lsbut mounting it fails. - A bind-mount to an NFS/CIFS path fails because the export path is wrong or the share is unmounted.
- The error names a specific path after
mountthat does not exist on the host.
Common Root Causes
- Missing device path on a named local volume — a volume created with
--opt device=/srv/nfs/myappwhere that directory does not exist. - NFS/CIFS share not mounted or wrong export path — the
devicepoints at a network path that is not currently available. - Typo in the volume
deviceoption or Composedevice:field. - Directory deleted after the volume was created — the source existed at creation but was later removed.
- Wrong
o=mount options for NFS (missingaddr=, wrongnfsvers) so the mount target cannot resolve. - Relative or non-absolute device path that Docker cannot resolve at mount time.
Diagnostic Workflow
First, inspect the failing volume to see the exact driver options and device path:
docker volume ls
docker volume inspect myapp
Look at the Options block — device, type, and o tell you what Docker will try to mount:
docker volume inspect myapp --format '{{json .Options}}'
Confirm whether that device path actually exists on the host:
ls -ld /srv/nfs/myapp
mount | grep /srv/nfs
If it is an NFS/CIFS volume, verify the share is reachable and mounted where expected:
showmount -e nfs.example.com
sudo mount -t nfs nfs.example.com:/exports/myapp /srv/nfs/myapp # test manually
For a plain bind-mount, check the source you passed to -v:
docker run --rm -v /data/myapp:/app alpine ls /app
Example Root Cause Analysis
A Compose stack defines an NFS-backed named volume and the app container fails with failed to mount local volume: ... no such file or directory. Inspecting the volume shows what Docker tries to mount:
docker volume inspect stack_myapp --format '{{json .Options}}'
# {"device":":/exports/myapp","o":"addr=nfs.example.com,nfsvers=4","type":"nfs"}
The options look right, but testing the export reveals the real path on the server is /srv/exports/myapp, not /exports/myapp:
showmount -e nfs.example.com
# /srv/exports/myapp 10.0.0.0/24
The device path was wrong, so the kernel returned ENOENT. Correcting the Compose volume definition fixes it:
volumes:
myapp:
driver: local
driver_opts:
type: nfs
o: "addr=nfs.example.com,nfsvers=4"
device: ":/srv/exports/myapp"
Recreate the volume so the corrected option takes effect, then start the stack:
docker volume rm stack_myapp
docker compose up -d
For a simple bind-mount case, the fix is just creating the missing host directory before running: mkdir -p /data/myapp.
Prevention Best Practices
- Create host source directories (
mkdir -p) before starting containers that bind-mount them, or let your provisioning step ensure they exist. - Store NFS/CIFS export paths and mount options in version-controlled Compose files and validate them against
showmount -e. - Recreate named volumes after changing
driver_opts; Docker does not update options on an existing volume. - Use absolute paths for every
deviceoption and bind-mount source. - Add a startup check that verifies required mount points exist before launching services.
- Monitor NFS/CIFS availability so a disappearing share is caught before it breaks container starts.
Quick Command Reference
# Inspect the volume's driver options and device path
docker volume inspect myapp --format '{{json .Options}}'
# Confirm the device path exists on the host
ls -ld /srv/nfs/myapp && mount | grep /srv/nfs
# Verify an NFS export path and options
showmount -e nfs.example.com
# Recreate a volume after fixing options
docker volume rm myapp && docker compose up -d
# Test a plain bind-mount source
docker run --rm -v /data/myapp:/app alpine ls /app
Conclusion
failed to mount local volume: no such file or directory means the source path Docker was told to mount does not exist — a missing bind-mount directory or a wrong device option on a named local volume. Inspect the volume’s options, confirm the path exists (creating it or fixing the NFS export path as needed), and recreate the volume after any option change. Ensuring source paths exist before container start prevents the error entirely. For more volume fixes, see the Docker guides.
Fixed it? Get 500 Docker with AI & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Stuck on this? Start guided troubleshooting
Open an interactive diagnostic session with this error already loaded. Work a step-by-step plan, record what each check returns, land on a root cause, and export a clean incident summary — no account needed to start.
Did this fix your issue?
Solved it a different way?
Share the fix that worked for you — reviewed, then published to help the next engineer.
That looks like it may contain a secret (key, token, password, or connection string). Please remove it — a note with a detected secret can’t be published.
Thanks — that helps. Published notes appear after a quick review.
Trending errors this week
The error guides other engineers are actually reading right now.
- 1mount: wrong fs type, bad option, bad superblock
- 2Docker 'failed to set up container networking': Fix the Bridge and IP Pool
- 3Docker 'failed to create shim task': How to Fix the containerd Runtime Error
- 4Transport endpoint is not connected
- 5modprobe: FATAL: Module not found
- 6mount: wrong fs type, bad option, bad superblock
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.