Vaultwarden Backup and Restore with Docker Compose
Updated Nov 2026
verified on Ubuntu 26.04 · Nov 2026Back up a Docker Compose Vaultwarden while it runs, then restore the vault, attachments and signing keys from one archive.
- A running Vaultwarden installed as in the deploy guide (data in ~/vaultwarden/vw-data)
- sudo access — the data folder is owned by root
What the backup has to contain
Vaultwarden keeps everything in one data folder: the
SQLite database, file attachments, Sends, config.json if you ever saved
settings in the admin panel, and the rsa_key* files that sign login sessions.
The database alone is not enough.
This guide assumes the layout from How to Deploy Vaultwarden on a VPS.
Back up while the server runs
Do not copy db.sqlite3 from a running server. Vaultwarden has its own backup
command that writes a consistent snapshot into the data folder. The Docker image
ships without the sqlite3 tool, so use this command instead:
cd ~/vaultwarden
docker compose exec -T vaultwarden /vaultwarden backup
Archive the data folder with the snapshot, leaving out the live database files and the icon cache, then delete the snapshot from the data folder:
mkdir -p ~/backups
sudo tar czf ~/backups/vaultwarden.tar.gz -C vw-data \
--exclude=./db.sqlite3 --exclude=./db.sqlite3-wal --exclude=./db.sqlite3-shm \
--exclude=./icon_cache .
sudo rm vw-data/db_*.sqlite3
sudo tar tzf ~/backups/vaultwarden.tar.gz
The listing must show a db_….sqlite3 file and rsa_key.pem. Copy the archive
and your docker-compose.yml off the server. The archive holds your vault and
signing keys, so encrypt it before it leaves the box:
sudo cat ~/backups/vaultwarden.tar.gz \
| gpg --symmetric --cipher-algo AES256 -o ~/backups/vaultwarden.tar.gz.gpg
Decrypt it before restoring:
gpg -d ~/backups/vaultwarden.tar.gz.gpg > ~/backups/vaultwarden.tar.gz
Restore
On a new server, put docker-compose.yml back into ~/vaultwarden and copy the
archive to ~/backups. Then stop the container and move any existing data aside
rather than deleting it:
cd ~/vaultwarden
docker compose down
if [ -d vw-data ]; then sudo mv vw-data "vw-data.old-$(date +%s)"; fi
sudo mkdir vw-data
sudo tar xzf ~/backups/vaultwarden.tar.gz -C vw-data
Rename the snapshot to the name Vaultwarden expects, and start the server. The
archive contains no -wal file, so there is no stale journal to replay over
the restored database:
sudo sh -c 'mv vw-data/db_*.sqlite3 vw-data/db.sqlite3'
docker compose up -d
sleep 10
docker compose ps
Paid link — we earn a commission if you shop through it.
Check that it worked
Log in from a Bitwarden client, open an item, and download an attachment. A
client that was logged in before the restore should stay logged in, because the
signing keys came back with the data. Once you are sure, remove the
vw-data.old-… folder.
What we tested
On 2026-11-27, on Ubuntu 26.04 with Vaultwarden 1.37.5: we stored a vault item with an attachment, backed up, removed the containers, images and data, and restored from the archive. The item and attachment came back identical, and a session opened before the backup was still accepted. We used a small test vault with the default SQLite database, not PostgreSQL or MySQL.
Automate it
Run the two backup blocks from a root cron job, add the date to the archive name, and send the encrypted copy to another machine or object storage. Repeat the restore on a spare server now and then: an archive you have never restored is unproven.
Next steps
Common questions
How long does it take to follow "Vaultwarden Backup and Restore with Docker Compose"?
We estimate about 20 minutes of hands-on time for "Vaultwarden Backup and Restore with Docker Compose"; this is an editorial estimate, not a measurement.
Was the "Vaultwarden Backup and Restore with Docker Compose" guide tested?
The "Vaultwarden Backup and Restore with Docker Compose" guide was verified end-to-end on Ubuntu 26.04 (Nov 2026).