By default, data in a container is ephemeral — lost when the container is removed. Volumes (and bind mounts) provide persistent storage that outlives containers, essential for databases and any data that must survive container restarts/removals.
The problem: containers are ephemeral
A container's writable layer is DELETED when the container is removed:
→ data written inside the container (e.g. a database's files) is LOST
→ containers are meant to be disposable/replaceable → don't store important data in them
→ For persistent data, you need storage OUTSIDE the container's lifecycle.
