Types

TypeSyntaxManaged byUse for
Bind mount/host/path:/container/pathYouDev, config, temp files
Volume mountvolume-name:/container/pathDockerProduction, databases
tmpfs--tmpfs /tmpRAMEphemeral scratch space

Bind mount

Direct mapping — container and host share the exact same files, two-way in real time.

docker run -v /host/path:/container/path myimage

Good for development (live code updates). Security risk: container can modify/delete host files.

Volume mount

Docker manages storage (typically /var/lib/docker/volumes/). More isolated, portable across hosts.

docker run -v my-volume:/container/path myimage

Use docker volume inspect <name> to find the actual host path.