How to back up a Redis Docker container (2026)
Want a Redis backup that actually restores? Dump it with `redis-cli SAVE # then capture the resulting dump.rdb` from inside the container instead of copying /data. a SAVE/BGSAVE forks a point-in-time RDB snapshot to disk, so you back up the finished dump.rdb (plus the AOF if enabled) rather than volatile in-memory state. Dockstash then restics the dump for encrypted, deduplicated, off-site snapshots.
What Dockstash detects
| Env keys detected | REDIS_PASSWORD, REDIS_ARGS |
|---|---|
| Default port | 6379 |
| Live data paths (never copied live) | /data, /data/dump.rdb, /data/appendonly.aof |
| Example images | redis:7-alpine, redis:7, redis:6, redis |
The dump command
redis-cli SAVE # then capture the resulting dump.rdbThe restore command
place dump.rdb in the data dir and start redis-servera SAVE/BGSAVE forks a point-in-time RDB snapshot to disk, so you back up the finished dump.rdb (plus the AOF if enabled) rather than volatile in-memory state.
Gotchas to avoid
- Copying an in-progress dump.rdb while Redis rewrites it yields a truncated file; trigger SAVE (or BGSAVE) first, then back up the finished RDB.
- If AOF persistence is enabled, back up the appendonly.aof file(s) too — the RDB alone may lag behind the latest writes.
- Redis restore requires the server to be stopped or restarted to load the RDB; you cannot hot-swap dump.rdb into a running instance.
Do it in one click with Dockstash
Dockstash runs the exact dump above, restics it off-site, and drill-tests the restore automatically — no script to maintain.
Last updated: July 2026
Frequently asked questions
Is Redis worth backing up at all?
It depends on your use. As a pure cache, a lost Redis is repopulated automatically. As a primary store (queues, sessions, sorted-set data), yes — back up the RDB, and the AOF if enabled.
SAVE vs BGSAVE — which does Dockstash use?
BGSAVE forks and snapshots in the background without blocking; SAVE blocks until done. Dockstash prefers a background save and then backs up the finished dump.rdb once it is written.
What about AOF (append-only file)?
If appendonly is enabled, the AOF holds the most recent writes that the RDB may not yet reflect. Dockstash captures both /data/dump.rdb and appendonly.aof so no recent data is lost.
Can I copy dump.rdb while Redis is running?
Only after a completed SAVE/BGSAVE. Copying while a rewrite is in progress can grab a partial file. Dockstash triggers the save and waits for it to finish before backing up.