I have a general question as it relates to using databases within Docker.
I have a simple web application with a database and flask / html on the front end.
Ideally, I’d like to run “docker-compose up” to spin up the two containers that house web service and the database. As users add to the database by adding blog posts etc., I’d like that data to persist. Even if I stop the containers, when I spin them back up, will all of that database data persist? My DB is postgres.
So questions are:
- Will that data persist even if I stop my container and then start it back up at a later time?
- Where does that data persist if it does? How can I configure my container to make sure there is enough GB storage for it there?
- Am I thinking about this the right way? Is there a better way to accomplish having a web application with a front end and back end.
- Can you explain the networking. How does the web server container talk to the database server? is it over TCP/IP and if so, how does it assign IP addresses etc?
- Do I need to mount a volume from my local host in order to make this happen? (I am using windows so is that mounting pretty straight forward?)
Thanks in advance!