I’d say that the most important takeover of this approach is to stop all the containers before the backup. Some applications (like databases) are extremely sensitive to data corruption. If you simply ´cp´ while they are running you may copy files of the same program at different point in time and get a corrupted backup. It is also important mentioning that a backup is good only if you verify that you can restore it. There are so many issues you can discover the first time you recover a backup, you want to be sure you discover them when you still have the original data.
Comment on Docker Backup Stratagy
greatley@ani.social 9 months ago
I don’t know if it’s best practice but I mount everything to a specific folder instead of volumes. I also just stop all the containers before a backup instead of database dumping. Then just do an encrypted B2 backup using Restic. So far I had to restore twice in six years of running this system and assuming the folder path is the same the only thing after downloading all the data I had to do was
docker-compose up -d
lorentz@feddit.it 9 months ago
dabe@lemmy.zip 9 months ago
yeah this is the way. as part of my borgmatic script I bring down all the stacks that have databases, let the backup run, then bring those stacks back up. as long as the containers aren’t running (and as long as the container properly closes itself down, not really something to be worried about though), any method of data back up should be fine.
I do this with quadlets and systemd targets now but before I was doing it with a bunch of
docker compose downcommands.It is quite convenient for restoration, as you say