mediumFoundationSymptom-first#volumes#mount#bind#path

Bind mount appears empty — container sees no files

Container shows empty directory for a bind mount path

Likely source:configuration

Focused incident mode — strips away everything but this runbook.

Symptoms

  • Container shows empty directory for a bind mount path
  • Files exist on the host but not inside the container
  • docker inspect shows mount destination but ls inside shows nothing

Docker treats -v /container/path (single argument) as a named volume, not a bind mount. Always use -v /host:/container for bind mounts.

Evidence to grab

Collect these artifacts before you change anything — they prove (or rule out) each cause.

  • Mount configuration

    docker inspect <CONTAINER> --format='{{json .Mounts}}'
  • Host path contents

    ls -la /host/path

Diagnostic flow

Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.

Guided decision tree is ready.

Steps with commands, expected output, and pass/fail branches.

Ranked root causes

Evidence checklist

  • docker inspect shows Source as a Docker volume path, not the host path
  • Run command used -v /path (missing host side: -v /host:/container)
  • Docker interprets -v /container as a named volume

Confirm before fixing

docker inspect <CONTAINER> --format='{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}}{{println}}{{end}}'
READ

Show mount type and paths

Expected: bind /host/path -> /container/path

If it shows 'volume ... -> /container/path' instead of 'bind', Docker created a named volume.

Fix

docker run -v /host/path:/container/path <IMAGE>
CHANGE

Use the correct -v host:container syntax for bind mounts

Resolution runbook

Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.

1
docker inspect <CONTAINER> --format='{{json .Mounts}}' | python3 -m json.tool
READ

Inspect mount source and destination

2
ls -la /host/path
READ

Verify source directory has content

3
docker inspect <CONTAINER> --format='{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}}{{println}}{{end}}'
READ

Confirm mount type is 'bind', not 'volume'

4
docker run -v /host/path:/container/path <IMAGE> ls /container/path
CHANGE

Recreate with correct bind mount syntax

Prevention

  • Always use the two-argument form: -v /absolute/host/path:/container/path.
  • Use --mount type=bind,src=/host/path,dst=/container/path for explicit bind mounts.
  • Verify mounts after docker run with docker inspect --format='{{json .Mounts}}'.
  • Prefer docker-compose volume syntax which makes the distinction explicit.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.