beginnerStorage: Volumes, Bind Mounts & tmpfs
Postgres data vanished after a routine container image upgrade
A team upgraded their postgres:15 container to postgres:16 by stopping the old container, removing it, and starting a new one — all data was lost. Diagnose. Expected reasoning: the original container was likely run with no persistent storage at all (writable layer only), so docker rm destroyed the writable layer along with all data. Fix going forward: always run stateful services with an explicitly named volume (--mount type=volume,src=pgdata,...) so container replacement is decoupled from data lifecycle; verify with docker volume ls before any docker rm.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.
Postgres data vanished after a routine container image upgrade