Use this before you bump a Docker tag, run apt upgrade on a homelab host, or click Update in a web UI. For a fuller off-site backup plan see our 3-2-1 restic guide. For image tags, see pin tags and back up volumes.
1. Know what to save
For most self-hosted apps, the pieces that matter are:
- Application data — photo libraries, media, documents, vaults, the thing you would be sad to lose.
- Databases — often a Postgres, MySQL or SQLite file sitting behind the app. This is usually more important than the container itself.
- Config — Compose files,
.env, Nginx/Caddy/Traefik config, and any/configbind mounts. - Secrets — API keys and passwords. Keep them out of git; do back them up somewhere you control. Our secrets checker will flag ones sitting in a Compose file in plain text.
- A rollback point for the host — a VM or container snapshot, a ZFS snapshot sent off-disk, or a Proxmox Backup Server job.
The container image is replaceable. The volume usually is not.
2. Keep Compose files in git
A pinned tag in docker-compose.yml is the update. Commit that file (and the rest of the stack, minus secrets) so you can see what changed and put the old tag back. Official Compose reference: services.
services:
vaultwarden:
image: vaultwarden/server:1.37.4
volumes:
- vaultwarden_data:/data Updating then becomes a one-line diff. Paste a file into the Compose update checker if you want the current SafeToUpdate verdict for every tracked image.
3. Back up named Docker volumes
Docker’s volumes documentation shows the usual pattern: stop the service, start a throwaway container that mounts the volume, and tar it to the host.
docker compose stop vaultwarden
docker run --rm -v vaultwarden_data:/data -v "$PWD":/backup alpine \
tar czf /backup/vaultwarden_data-$(date +%F).tgz -C /data .
docker compose start vaultwarden Copy that archive off the machine — another disk, a NAS, or an object store — before you pull a new image. Bind mounts are simpler: rsync or tar the host directory, again with the app stopped if it is writing files.
4. Dump databases; don’t copy a live data directory
A file-level copy of a running Postgres or MySQL data dir is a common way to get a backup that will not restore. Use the database’s own tools, then back up the dump.
# Postgres, via the running container (adjust service and user names)
docker compose exec -T db pg_dump -U appuser appdb > appdb-$(date +%F).sql
# MySQL / MariaDB
docker compose exec -T db mysqldump -u appuser -p appdb > appdb-$(date +%F).sql
# SQLite: stop the app, then copy, or use the official backup command
docker compose stop app
docker compose exec -T app sqlite3 /data/app.db ".backup /data/app.db.bak" Official references: pg_dump, mysqldump, and SQLite’s backup API / .backup.
5. Snapshots are for fast undo; backups leave the disk
Proxmox, ZFS, btrfs and TrueNAS all make snapshots cheap. That is a gift when an update goes wrong and you want to roll back in a minute. It is not a backup if the snapshot lives on the same disk you are about to upgrade, or the only disk in the machine.
- Proxmox VE: a VM or CT snapshot is a convenient checkpoint. For a real copy, use
vzdumpor send the guest to Proxmox Backup Server. PBS 4.2 is the current release we track; read the Proxmox VE page and our PVE update guide before upgrading the host itself. - ZFS / btrfs: snapshot, then
zfs send/btrfs sendto another pool or a NAS. A local snapshot alone will not survive a failed pool. - TrueNAS: take the snapshot, then replicate it to another pool or another NAS. You can also roll back a boot environment after a failed SCALE update — that still is not a substitute for a copy of your data.
If you prefer a file-level tool, Kopia and restic both do incremental, encrypted backups of directories and can store them on a NAS or object storage.
6. Test the restore (the step people skip)
A backup you have never restored is a hope. You do not need a perfect disaster-recovery drill. You need proof that yesterday’s archive opens.
- Named volume: create a throwaway Compose project, mount a copy of the archive into a new volume, start the app on a different host port, and log in. Confirm the library, vault or documents you expect are there.
- Database dump: start a fresh Postgres or MySQL container, load the dump, and run a couple of queries — row counts, a recent record, the admin user.
- PBS / vzdump: restore one guest or one archive to a spare VMID (not over the live one) and boot it. Official PBS restore docs start at the Proxmox Backup Server documentation.
- SQLite or config: open the file; does the app start against it?
Two traps show up over and over:
- You cannot reliably restore a backup taken on a newer app version into an older one. Keep the pre-update backup until you are done with the new version. (UniFi’s
.unfbackups are a well-known example.) - A “backup” that never left the disk you just updated is gone if the update fills the disk or corrupts the filesystem.
7. Then, and only then, update
- Read the official release notes and the verdict on the app’s SafeToUpdate page.
- Note the version you are on now.
- Pin the new tag (no
:latest), update one app at a time, and watch the logs. - Click through the features you actually use before you walk away.
- Keep the pre-update backup until the new version has been in use for a few days.
Related reading: a safe Docker update workflow, updating Immich safely, and notify, don’t auto-update.
Questions
Is a Proxmox or ZFS snapshot enough?
A snapshot on the same disk is a fast undo, not a backup. If that disk dies, the snapshot goes with it. Keep a copy somewhere else — another disk, a NAS, or Proxmox Backup Server — before you update anything you care about.
Can I copy a live Postgres or MySQL data directory?
Not safely. A copy taken while the database is writing can be unreadable. Stop the app or take a proper dump (`pg_dump`, `mysqldump`) and back up the dump. SQLite should be copied only after the app is stopped, or with the sqlite3 `.backup` command.
How do I know a backup is good?
Restore it once, on purpose, before you need it. Bring the dump or volume up in a throwaway Compose project or a spare container, start the app, and check that the data you care about is actually there.
How long should I keep the pre-update backup?
Until you have used the new version for a few days and you are sure you will not roll back. A backup taken after a bad migration will not help you go back. Backups from a newer app version often cannot be restored into an older one.
Want a project tracked, or a step this guide missed? Suggest it.