Hacker News new | ask | show | jobs
by raziel2p 3217 days ago
I have to imagine it's about how bad a crash would affect you. If you can make hourly backups and the data loss is not a huge deal, I don't see why you wouldn't, but for more important stuff just go the extra mile and get some VMs.
1 comments

Why would you have data loss? Why would crashes be worse than when Postgres is not run in a Docker container?

In our project we ran a master/slave Postgres setup and hourly backups. I don't fully remember the details, but as far as I know that's as safe as you can get regardless of Docker.

> Why would you have data loss?

It might seem obvious to use volumes and maybe even cronjob to backup your data but a large amount of the instructions you find on the docker hub don't mention it. In any case, if you blindly copy and paste the instruction, you'll end up with data loss.

> Why would crashes be worse than when Postgres is not run in a Docker container?

because if you use docker wrong, the state of your system will leave inside the container and will be flush if you reboot your machine. If you don't use docker, the state of your system will always remain in your disk until your disk crash.

> In our project we ran a master/slave Postgres setup and hourly backups. I don't fully remember the details, but as far as I know that's as safe as you can get regardless of Docker.

It's working great for me too but the point is if you do it wrong, you'll burn yourself. I guess that's the same thing for any piece of tech but behind it's apparent simplicity, it's quite easy to do a mistake with docker and if you do so, say goodbye to your data

> ...state of your system will leave inside the container and will be flush if you reboot your machine.

Nope, the state of the container will survive until you remove the container. Reboots DO NOT refresh a container (you can have the docker daemon automatically bring your containers back up on reboot).