How Do You Back Up Docker Volumes and Databases Properly?
Back up Docker by backing up the data, configuration, and restore instructions, not the running container. For databases, use application-aware dumps or backup tools, then store those dumps with the volume backups and test restore into a new stack.
Design principle: Separate working data, local recovery, and offsite recovery. One box can help, but one box should not be the whole plan.
Step 1Separate app types
Static files, config, and databases need different backup actions.
Step 2Dump before backup
Create database dumps before the backup job captures the directory.
Step 3Restore elsewhere
Restore into a new folder or VM so the test does not overwrite production.
The Short Version
- Back up Docker by backing up the data, configuration, and restore instructions, not the running container. For databases, use application-aware dumps or backup tools, then store those dumps with the volume backups and test restore into a new stack.
- Use the decision matrix below, then prove the result with the validation checklist before making it the default.
Why This Matters Now
The useful answer starts with the operating model. Who depends on this service, what breaks when it is unavailable, and how quickly does it need to be restored? Those questions matter more than the product name.
A Compose file is easy to recreate; the volume and database state are the valuable parts.
Copying a live database directory can produce a broken backup unless the database is stopped or dumped correctly.
Restore testing is the only way to know whether secrets, networks, volume paths, and database credentials were captured.
The rest of this guide turns that context into a baseline design, implementation order, validation checks, and buying notes. That is the TechGeeks bias: a setup is not good because it worked once. It is good when it can be explained, tested, and recovered.
Recommended Baseline
Use three buckets in the design: production data, fast local recovery, and offsite recovery. Production data may live on a NAS, mini PC, DAS, cloud drive, or application server. Fast local recovery can be snapshots, image backups, app exports, or a second local copy. Offsite recovery must survive the house, the account, or the device being unavailable.
Do not let sync pretend to be backup. Sync keeps locations aligned; backup keeps recoverable history. If deletion, encryption, or corruption can propagate to every copy within minutes, the setup still needs a separate recovery layer.
Decision Matrix
| Choice | Best Fit | Watch Point |
|---|---|---|
| Volume file copy | Static app data and uploads. | Unsafe for busy databases. |
| Database dump | PostgreSQL, MariaDB, MySQL, Redis exports. | Needs scheduling and retention. |
| Restic/Borg/Kopia | Encrypted deduplicated backups. | Still needs app-aware pre/post hooks. |
| Storage snapshots | Fast local rollback. | Not a full offsite backup alone. |
Decision Worksheet
Before copying the recommendation, fill out this worksheet for your own home or lab. The right answer can change when the same tool is used for family photos, router access, media playback, cameras, or a disposable test stack.
| Worksheet Item | What To Write Down | Why It Matters |
|---|---|---|
| Primary question | How do I back up Docker containers and databases properly? | This keeps the article tied to the reader's real decision instead of drifting into a generic product comparison. |
| Affected systems | People, apps, and devices that create or need the files, photos, backups, databases, or shares. | Readers should know who and what they are protecting before they choose hardware, software, or a cloud service. |
| Failure model | Deletion, ransomware, drive failure, bad sync, account lockout, theft, fire, and hardware replacement. | Different failures need different controls. This row prevents RAID, sync, VPN, or MFA from being treated as magic. |
| Proof test | Restore a real folder, one recently changed file, and one app-owned data set to a clean location. | A recommendation is not proven until it survives a small, repeatable test using realistic data, clients, or accounts. |
| Rollback path | Keep the original copy and credentials available until restores, permissions, and metadata are confirmed. | A reversible change is less stressful, easier to explain, and less likely to turn a weekend project into an outage. |
| Measurement to capture | Usable capacity after parity, mirrors, snapshots, and retention. | Numbers, logs, screenshots, or restore notes give the reader confidence that the decision was based on evidence. |
Database-Aware Backup Examples
A stopped container is easy to recreate; the live data is not. PostgreSQL wants pg_dump or pg_dumpall for logical backups. MariaDB and MySQL want mariadb-dump or mysqldump. SQLite often needs the app stopped or a proper online backup method. Redis may need RDB/AOF handling depending on the app.
A safe pattern is pre-backup dump, encrypted repository backup with Restic/Borg/Kopia, repository check, and restore into a clean Compose stack. If the restore requires secrets that exist only in the dead host's .env file, the backup is incomplete.
Real-World Example
Consider a household with two laptops, three phones, a small NAS, and a growing photo library. The safe design is not buying more drive bays. The working copy lives where the apps need it, a local backup gives fast restore, and an offsite or offline copy protects against theft, fire, ransomware, and account loss. The article's recommendation should be considered successful only after a real folder or database is restored to a clean location.
Walk the decision in priority order. Put irreplaceable data first: family photos, personal documents, password-vault exports, app databases, and project files. Put painful-but-replaceable data next: VM images, media metadata, downloads that took time to curate, and configuration folders. Put disposable cache last. Then give each tier a working location, a fast restore path, and a separate recovery path.
This is where many storage articles get too shallow. A NAS, DAS, cloud drive, or sync tool is only one part of the answer. The reader needs to know what happens after the laptop is lost, after the NAS pool fails, after an account is locked, and after a sync client deletes the wrong tree. The example succeeds only when a restore from a separate path works without trusting the original system.
Rollout And Recovery Plan
Roll this out in three passes. First, identify the data that is truly hard to replace: photos, documents, app databases, password-vault exports, encryption keys, and machine backups. Second, build the working path that people will use every day. Third, prove recovery from a separate path before deleting, migrating, or reorganizing the original copy.
The recovery test should be specific enough to catch real gaps. Restore one normal folder, one recently changed file, and one application-owned data set such as a photo-library database, container volume, or backup catalog. Check filenames, timestamps, permissions, thumbnails, and whether the restored data opens on a different machine. A backup that only restores onto the same healthy system is not the recovery plan you want during a hardware failure.
Implementation Details
Implement this in a maintenance window, even if the word maintenance feels too formal for a home lab. The point is to avoid changing several hidden dependencies while someone else expects the internet, photos, media, smart home, or passwords to keep working.
- List every Compose project, volume, bind mount, database, and secret file.
- Add database dump jobs for PostgreSQL, MariaDB/MySQL, SQLite, Redis, and app-specific exports.
- Back up Compose files,
.envtemplates, reverse proxy config, and documentation. - Encrypt backups before sending them offsite.
- Run a restore drill into a clean Docker host.
Record these details while you build, not after the memory has already gone fuzzy:
- Usable capacity after parity, mirrors, snapshots, and retention.
- Restore time for a realistic folder, VM, app database, or photo library.
- Offsite copy age and whether backup credentials are separate from normal user credentials.
- Drive health, scrub status, alert delivery, and UPS shutdown behavior.
Evidence To Collect
The article should leave the reader with something they can verify. Collecting evidence sounds formal, but it can be as small as a restored folder, a router config export, a playback dashboard capture, or a clean-browser login test.
- A data inventory that separates irreplaceable, painful-to-recreate, and disposable data.
- Screenshots or logs from the latest backup job, snapshot job, scrub, SMART check, and offsite sync.
- A restore note showing what was restored, where it was restored, how long it took, and what did not come back cleanly.
- A credential note proving backup administration is separate from normal daily user access.
- Capacity math that includes snapshots, retention, app databases, photo growth, and replacement-drive budget.
Failure Signals
- Backups complete but nobody has restored from them.
- Snapshots and sync jobs live on the same system as the only important copy.
- Drive, UPS, or scrub alerts go to an inbox nobody checks.
- Cloud-only files, app databases, or metadata are missing from the backup plan.
Adopt, Pilot, Defer, Avoid
- Adopt: Adopt the design when it separates working data, local recovery, and offsite or offline recovery.
- Pilot: Pilot with one folder, one app export, or one photo subset before reorganizing the whole data set.
- Defer: Wait when the current setup is stable, backed up, monitored, and the proposed change is mostly curiosity.
- Avoid: Avoid treating RAID, snapshots, sync, or cloud drive alone as a complete backup plan.
Validation Checklist
- A new host can start the Compose stack from backed-up files.
- Database dumps import cleanly.
- Uploaded files and app media are present after restore.
- Secrets are restored from a secure location, not committed to Git.
- Backup logs and alerts are checked.
Common Mistakes
- Backing up only the Compose YAML.
- Copying live database directories without dumps or snapshots.
- Committing
.envsecrets to a public repository. - Using one backup job for every app without understanding data consistency.
- Never testing restore after changing volume paths.
Troubleshooting
| Symptom | Likely Cause | First Check |
|---|---|---|
| Restore fails | Backup captured files but missed app state, permissions, keys, or database exports. | Restore to a clean folder or VM and compare timestamps, permissions, and app behavior. |
| Storage feels slow | Network, disks, protocol overhead, Wi-Fi, or client limits are the real bottleneck. | Test wired transfer speed, disk health, and client link speed separately. |
| Backups look successful but feel risky | Jobs report completion without proving recovery. | Schedule a restore drill and record exactly what did and did not come back. |
Maintenance Cadence
The best design is the one that still makes sense three months later. Put these checks on a calendar so the setup does not depend on memory.
- Monthly: Check backup job status, drive health, free space, and the age of the newest offsite copy.
- Quarterly: Restore a real folder or app export to a clean location and confirm permissions, metadata, and versions.
- Yearly: Review capacity, replace aging drives or UPS batteries as needed, and confirm the offsite copy still matches the risk.
Storage maintenance should always include a restore test. Green check marks from backup jobs are useful, but they do not prove that permissions, databases, metadata, encryption keys, and offsite access will work when the original system is gone.
When To Spend Money
Product links make sense only after the reader knows what problem the purchase solves. Use this table to keep buying advice tied to evidence, not anxiety or a tempting sale price.
| Stage | Signal | Practical Buying Guidance |
|---|---|---|
| Do not buy yet | Restore has not been tested, data has not been tiered, or the existing bottleneck is unknown. | Spend time on inventory, restore proof, labels, and documentation before buying another enclosure. |
| Small useful spend | Backups are working but the weak point is power, replacement media, or offsite transport. | UPS with shutdown signaling, external backup drive, spare drive, drive labels, or a safe storage case. |
| Larger upgrade | Capacity, restore time, drive bays, network throughput, or app-data reliability is now a measured constraint. | NAS, larger disks, 2.5GbE/10GbE path, offsite target, or a separate compute host. |
Useful Gear And Buyer Notes
The product links below are intentionally search links, starting with external SSD 2TB, because model numbers, bundles, and prices change quickly. Use them to compare categories, then verify exact specifications against the article's decision points before buying. For infrastructure gear, prioritize firmware support, replaceability, warranty, idle power, and recovery behavior over headline specs.
Affiliate disclosure: As an Amazon Associate, TechGeeks may earn from qualifying purchases. The product links below are buying references, not a requirement to buy a specific brand or seller. Verify compatibility, seller quality, warranty, and current specs before ordering.
- Amazon search: external SSD 2TB
- Amazon search: NAS hard drive 8TB
- Amazon search: mini PC Docker server
- Amazon search: USB hard drive dock
Related TechGeeks resources
- Media Server Storage Design: NAS, CIFS/NFS Mounts, Permissions, and Local Cache
- Backup and Disaster Recovery for Plex, Sonarr, Radarr, Tdarr, Prowlarr, and SABnzbd
- Monitoring and Health Checks for a Plex and Arr Homelab
What This Does Not Protect or Validate
This guide does not guarantee that vendor pricing, product bundles, firmware behavior, subscription terms, or cloud policies will stay the same. Verify current documentation before final buying or migration decisions.
It also does not replace a full security, backup, or disaster-recovery program. The goal is to give you a practical design, the tests that prove it, and the boundaries that keep the recommendation honest.
RAID, snapshots, sync, and cloud drives are useful controls, but none of them proves recovery until you restore real data from a separate path.
Practical FAQ
How do I back up Docker containers and databases properly?
Back up Docker by backing up the data, configuration, and restore instructions, not the running container. For databases, use application-aware dumps or backup tools, then store those dumps with the volume backups and test restore into a new stack. The important next step is to validate the recommendation with one small test before treating it as the default.
References
- https://docs.docker.com/compose/
- https://www.postgresql.org/docs/current/backup-dump.html
- https://mariadb.com/kb/en/mariadb-dump/
- https://restic.readthedocs.io/en/stable/
- https://borgbackup.readthedocs.io/en/stable/
Final Thought
The right answer is the one you can operate, document, test, and recover without guessing.
Need help applying this?
Bring TechGeeks into the real environment.
If you are working through this on a live network, WordPress site, Linux server, AI workflow, or PisoWiFi deployment, send the context and we can help turn it into a practical plan.

