advancedTop 100 Interview Questions
How would you persist PostgreSQL data across container recreation in Compose?
Mount a named volume to the container's data directory (`/var/lib/postgresql/data`) via the service's `volumes:` key and declare that volume in the top-level `volumes:` section — recreating the container (e.g., on image update) then reuses the same underlying data.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.
How would you persist PostgreSQL data across container recreation in Compose?