Skip to content

Docker Volumes vs Bind Mounts

Two ways to persist and share data

By default, anything written inside a container disappears when the container is removed. To persist data, Docker provides two main options: volumes and bind mounts.

Rule of thumb:

Key Terms

Volume
A Docker-managed data store that exists independently of any container. Stored under /var/lib/docker/volumes by default.

Anonymous Volume
A volume created automatically without a name. Tied to the container that created it.

Bind Mount
A mapping of a host directory into a container. Unlike volumes, bind mounts are not managed by Docker.

Persistence
Data that remains available even after containers are stopped or removed.