Pcornel
Containers · Container Storage

Volumes vs Bind Mounts

Cheat sheet · https://pcornel.dk/topic.php?topic=6134

Back to the Topic

Answer

Volumes are managed by the container engine (stored under its data directory); bind mounts map an existing host path into the container.

Remember

Volumes are portable and safer for most data; bind mounts suit config files and development. Bind mounts expose host paths and need matching ownership and SELinux labels.

First checks

  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker inspect <c> — config, mounts, network, state

Commands

docker rm
docker volume rm

Verify in this order

volume or host path → mounted at container path

Where it usually breaks

A bind mount over a directory hides the image content at that path.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6134

Confirmation

Confirm action

Continue?