DockerMid

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 denied inside 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

  1. 1
    Check the host path exists
    ls -ld /host/path

    Typos and relative paths are the usual cause. Use an absolute path or $(pwd).

  2. 2
    See what Docker actually mounted
    docker inspect --format '{{json .Mounts}}' CONTAINER

    Shows the source, destination and mode (rw or ro) for each mount.

  3. 3
    On an SELinux host, check the mode
    getenforce

    Enforcing means labels are applied. If it is Permissive or Disabled, SELinux is not the cause.

Causes and fixes

  • The source path does not exist

    HOW TO TELL
    The exact bind source path does not exist error.
    ROOT CAUSE
    --mount type=bind requires the host path to exist before the container starts.
    FIX
    Create the directory first, or use the bind-create-src option 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, getenforce says Enforcing.
    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 :Z on a system directory such as /home or /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 :ro for mounts the container only reads.

Keep going

Sources

Docker documentation (docs.docker.com), read 18 Nov 2026 from the official docs repository.

Search

Search cheat sheets and projects