How to back up a Valkey Docker container (2026)

Backing up Valkey safely means one rule: dump, don't copy. `valkey-cli SAVE # then capture the resulting dump.rdb` produces a consistent, restorable dump from the running container, which restic then encrypts off-site. 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. Anything that copies /data live risks an unrestorable backup.

Detection

What Dockstash detects

Env keys detectedVALKEY_PASSWORD, VALKEY_ARGS, REDIS_PASSWORD
Default port6379
Live data paths (never copied live)/data, /data/dump.rdb, /data/appendonly.aof
Example imagesvalkey/valkey:8, valkey/valkey:7, valkey/valkey
Commands

The dump command

valkey-cli SAVE # then capture the resulting dump.rdb

The restore command

place dump.rdb in the data dir and start valkey-server

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.

The gotchas

Gotchas to avoid

  • As with Redis, never grab a dump.rdb mid-rewrite — trigger SAVE/BGSAVE first and back up the finished file.
  • valkey-cli is the client binary; on some compatibility images redis-cli is symlinked, so Dockstash detects whichever is present.
  • Enable and capture the AOF when you need the freshest writes; the RDB alone can trail behind.

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.

Start free All guides

Last updated: July 2026

Frequently asked questions

How is backing up Valkey different from Redis?

It is not, meaningfully. Valkey forked from Redis and keeps the same RDB and AOF persistence model. The only practical difference is the client binary name (valkey-cli), which Dockstash detects automatically.

Can I restore a Redis RDB into Valkey?

Yes for current versions — the RDB format is shared across the fork point. As the projects diverge, keep restores within the same engine to be safe.

Does Dockstash detect Valkey automatically?

Yes. The valkey/valkey images and the valkey-cli binary are recognized, and both VALKEY_PASSWORD and the legacy REDIS_PASSWORD env keys are picked up.

Should I capture the AOF as well?

If appendonly is enabled and you cannot afford to lose the most recent seconds of writes, yes. Dockstash backs up both the RDB and the AOF files.