简体   繁体   中英

How Are Databases Managed With Docker?

I understand what Docker is and how you can package your application to run instantly anywhere. What I don't understand is: what do you do about the Database?

Do you make another Docker image/container just for the DB? This seems wrong because if that container disappears, so does your data, I guess forever.

Or do you package your DB in the same container as your application? In this case, scalability is gone.

So how is it done?

Thank you

Volumes are the solution.

Adding a volume to your database will make the data persistent as long as that volume exists, though there are situations where this doesn't quite work out of the box, so remember to do your backups.

Your database will, in most scenarios, be separated from your application as far as the non development deployments go, so it will have its own scalability and backup policy, so your application scalability should not be tied to your database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM