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 down
commands.
It is quite convenient for restoration, as you say
lorentz@feddit.it 1 week ago
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.