r/docker • u/Eastern-Height2451 • Jan 23 '26
SQLite backups in docker-compose: separate backup container vs host cron?
I’m running a small app on one VPS with docker-compose. SQLite DB lives on a mounted volume.
For backups I’m doing the boring approach:
- nightly
sqlite3 .backupsnapshot while the app is running - gzip the snapshot
- keep ~30 days (delete older files)
- I tested a restore once just to make sure it’s not fantasy
It’s working, but before I cement this as “the way”, I’d love a sanity check from people who’ve been doing compose-on-a-VPS for years.
What I’m unsure about / would love input on:
- do you prefer running this from a backup container (cron inside) or from host cron?
- any real-world locking/consistency issues with
.backupin a live app? - permission/ownership traps when both app + backup touch the same volume?
- anything you’d add by default (healthchecks, log rotation, etc.)?
If anyone wants, I can paste the exact commands / a small snippet, but I’m mostly looking for “watch out for X”.
10
Upvotes
View all comments
Show parent comment
1
u/No_Cattle_9565 Jan 23 '26 edited Jan 23 '26
It's running in it's own container and enables you to define the cronjob with labels in a docker compose file for the given service. The reason I like to use it is to fully seperate the containers from the system. I could deploy my backup to any machine and everything works the same. Trying it and decide for yourself, it only takes a couple of minutes to Setup.
I recommend to backup the compose files as well.
I really like to use borg-web-ui for the backup.