Careeroza
Why Containers Lose Data
The Writable Layer
Files a container writes go to its own writable layer. When the container is removed (docker rm, or a redeploy), that layer and all its data are gone. Databases, uploads and anything else that must survive need external storage.
| Type | Stored in | Use for |
|---|---|---|
| Named volume | an area managed by Docker | databases and app data (recommended) |
| Bind mount | a folder you choose on the host | source code during development, config files |
| tmpfs | host memory only | temporary, sensitive files |