默认情况下,container 中的数据是临时的 — 当 container 被删除时丢失。Volumes(和 bind mounts)提供持久存储,其生命周期超过 containers,这对数据库和任何必须在 container 重启/删除后保留的数据至关重要。
问题:containers 是临时的
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.
