Bind mount errors: source path missing, hidden files, SELinux denials
A bind mount fails when the host path is missing, hides files from the image, or is blocked by an SELinux label. Check the path and add the label.
What you see
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /dev/noexist.- A mounted directory is empty or missing the files the image shipped with
Permission deniedinside the container on a path that is mounted from the host (on SELinux hosts)
What it means
A bind mount maps a host path into the container. With the --mount syntax Docker does not create a missing source for you, so it fails. Mounting over a directory that already has files in the image hides those files, and they come back only when you remove the mount.
On hosts that use SELinux, the container may not be allowed to read a host path with the wrong label, even when the Unix permissions are fine.
How to confirm the cause
- 1Check the host path exists
ls -ld /host/path
Typos and relative paths are the usual cause. Use an absolute path or
$(pwd). - 2See what Docker actually mounted
docker inspect --format '{{json .Mounts}}' CONTAINERShows the source, destination and mode (
rworro) for each mount. - 3On an SELinux host, check the mode
getenforce
Enforcingmeans labels are applied. If it isPermissiveorDisabled, SELinux is not the cause.
Causes and fixes
The source path does not exist
- HOW TO TELL
- The exact
bind source path does not existerror. - ROOT CAUSE
--mount type=bindrequires the host path to exist before the container starts.- FIX
- Create the directory first, or use the
bind-create-srcoption to have Docker create it.mkdir -p /host/path docker run --mount type=bind,src=/host/path,dst=/data IMAGE
The mount hides files from the image
- HOW TO TELL
- The directory inside the container is empty, or lacks files you know the image contains.
- ROOT CAUSE
- A bind mount replaces whatever the image had at that path. The docs advise recreating the container without the mount to see the original files again.
- FIX
- Mount to a different path, or copy the needed files into the host directory first.
SELinux label blocks access
- HOW TO TELL
- Permission denied inside the container,
getenforcesaysEnforcing. - ROOT CAUSE
- The host directory has a label that containers are not allowed to use.
- FIX
- Add
:z(shared among containers) or:Z(private to this container) to the mount. This relabels the host directory itself, so never use:Zon a system directory such as/homeor/usr; the docs warn it can make the host unusable.docker run -v /host/path:/data:z IMAGE
How to stop it coming back
- Create host directories in your setup script, not by hand.
- Prefer named volumes for application data.
- Use
:rofor mounts the container only reads.
Keep going
- Runbook: Docker commands only work with sudo
- Cheat sheet: Docker
- Cheat sheet: Linux Permissions
- Lesson: the containers topic in Learn
Sources
Docker documentation (docs.docker.com), read 18 Nov 2026 from the official docs repository.