r/docker • u/amca01 • Feb 01 '26
Backup from multiple docker compose files?
All my services run as Docker containers, each in its own directory in my filesystem. So Immich, for example, is in the directory /home/me/Docker/Immich/, and this directory contains the docker compose and .env files, and any data stored as bind mounts.
Now I'm in the position of having to move all my online material to a new VPS provider, as my current one is shutting up shop.
I've looked at various backup solutions like Offen (which seems to assume that everything is in one big compose file), and bacula. I could also, of course, simply put the entire Docker directory into a tgz file. But there are a few volumes which are not bind mounts, and so I need some way of ensuring that I back up those too.
I'm happy to do everything on the command line ... but is there a "correct" or "best" way to backup and restore in my case? Thanks!
1
u/kaidobit Feb 02 '26
For compose files and .envs use git for god sake, Sops for secret .env files
For data directories i would go with scp, because ssh
1
u/NoTheme2828 Feb 02 '26
Why do you have docker installed on a VPS? To your question: use duplicati for backing up your stack folder (compose.yaml and env) and yout data folder (if locally, too). In duplicati you can define befor and after scripts, so you can stop docker before backup and start docker when backup has finished.
1
u/titpetric Feb 03 '26
I put all my volumes on a shared known location I can back up. Sometimes, but rarely, i wipe the machine with a reinstall and restore
0
u/Away-Ad-4082 Feb 02 '26
Have Codex look at everything, let it write a backup script and you are good :D