Running MySQL on Docker

Hello r/docker,

I've come across a situation at work for which I'm.nit sure I know why it happens. We had a couple VMs running a LAMP stack on Docker with docker- compose, unfortunately sometimes I would notice that some databases were getting corrupted and we wouldn't be able to access the data. I tried to search the reason and I came across this article:

https://myopsblog.wordpress.com/2017/02/06/why-databases-is-not-for-containers/

Where the author writes "Docker is still unreliable working with currently available storage drivers. You may corrupt the data in case of container crash where database didn’t shutdown correctly. And lose the most important part of your service." , granted the article is not exactly new but I had that already in the back of my head. I then asked my boss (who manages the clusters) and he tells me that on some weekends they send a command to all Linux machines to update and reboot.

Could it be that the reboot command doesn't wait/"ask" docker to exit gracefully and so kills the container resulting in database corruption?

We already had to change the production server back to a normal LAMP stack due to downtime but I would like to keep the development under docker:) (given I'm the only developer for this project it's hard to test all possibilities)

Thank you for the help!

(This was written on mobile so I apologize for any typos).

submitted by /u/jgorgulhosantos
[link] [comments]
Source: Reddit