DEV Community

Discussion on: How To Install and Run PostgreSQL using Docker ?

Collapse
ydhnwb profile image
Prieyudha Akadita S

Very good article.
Im new in docker, i have a question, when running postgres container, we can connect to spesific db, what if i restart the postgres container? Is the database gone?

Collapse
lawrenceonen profile image
Onen Lawrence Lakuma

The reason you have to create a volume (which is mapped to your container) is to locally persist your data so that in the event you stop/restart your container, you can always have your data. So, your database stays though you will need the container running in order to access it.