The Ephemeral Problem
LEVEL 0
The Problem
You start a PostgreSQL container:
docker run -d --name db postgres:15
Your application connects to it and stores critical data—user accounts, orders, payment records.
Everything works great.
Then the container stops (crashes, server reboots, you run docker rm). You start a new database container:
docker run -d --name db postgres:15
All your data is gone. Every user account, every order, everything. Vanished.
Why? Because containers are ephemeral. When a container is removed, its filesystem is deleted. Any data written inside the container dies with it.
For stateless applications (web servers serving static code), this is fine. But for stateful applications (databases, file storage, caches), this is catastrophic.
How do you make data survive container lifecycles?