Bind mount appears empty — container sees no files
Container shows empty directory for a bind mount path
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}}'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>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.
docker inspect <CONTAINER> --format='{{json .Mounts}}' | python3 -m json.toolInspect mount source and destination
ls -la /host/pathVerify source directory has content
docker inspect <CONTAINER> --format='{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}}{{println}}{{end}}'Confirm mount type is 'bind', not 'volume'
docker run -v /host/path:/container/path <IMAGE> ls /container/pathRecreate 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.
Related runbooks
Same stack, same failure family — worth a skim.
Permission denied when writing to a bind-mounted directory inside the container
Data written inside container is gone after docker rm
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.