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.

TypeStored inUse for
Named volumean area managed by Dockerdatabases and app data (recommended)
Bind mounta folder you choose on the hostsource code during development, config files
tmpfshost memory onlytemporary, sensitive files