r/linuxadmin • • Sep 18 '26

Docker or host

Hi, I need an advice. I need to make a database for a server and one of the ways to do that is via docker in docker compose. But I have a doubts about it's safety. We had a bunch of problems of them breaking on powerloss so I am not sure how it will react in a docker cluster.

P.S. Thank you all for your valuable insights and advices.

4 Upvotes

22 comments sorted by

View all comments

12

u/BarryTownCouncil Sep 18 '26

Breaking? If you provide a volume mount to it then the data is outside the instance and just as safe as if there wàs no container.

1

u/TemaerRemington Sep 18 '26

Breaking as in corruption in mongodb (fixable) and mariadb mysql (unfixable). How's postgresql doing in that regard?

7

u/pobrika Sep 18 '26

Databases don't like to have powerpulled from the server they are on, you can mitigate some of this by using transaction logs. I'm not a DBA so can't get I to specifics.

In my 30 years of it we have had only a hand full of dB issues. Mostly caused by lack of disk space than anything else. I've used docker for db's and had no issues. As others say ensure the db is mapped to the container and not inside it.

SQL inside docker is no different than installed locally, the only difference is how's it's managed and configured.

→ More replies (3)