# Backing up docker volume of vaultwarden

**URL:** <https://vaultwarden.discourse.group/t/backing-up-docker-volume-of-vaultwarden/1452>\
**Category:** Help\
**Created:** [February 11, 2022, 10:30am UTC](https://vaultwarden.discourse.group/t/backing-up-docker-volume-of-vaultwarden/1452 "2022-02-11T10:30:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samsepi0l](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@samsepi0l](https://vaultwarden.discourse.group/u/samsepi0l)\
**Post date:** [February 11, 2022, 10:30am UTC](https://vaultwarden.discourse.group/t/backing-up-docker-volume-of-vaultwarden/1452/1 "2022-02-11T10:30:59Z")

</div>

HI,  
I want to backup automatically my vaultwarden, but I have some problems and I’m confused with my setup and I have security concerns too.  
So my vaultwarden is running on docker on a Rpi 4 8GB.  
On the **host** I use this exact command to backup volume (I only use for vaultwarden right now) :

> docker run --rm --volumes-from bitwarden -v /backup:/backup busybox tar cvfz /backup/backup.tar /data

I created a /backup on the **host** at the root that’s why the

> -v **/backup** :/backup

Moreover, I use duplicati for backup, so I tell duplicati to go /backup to backup the entire folder (potentially with other backups, not only vaultwarden) and it sends that to mega.nz  
I went to /etc/crontab to insert the “docker backup” command but it doesn’t do anything at the time I specified so nothing happens.

I am really paranoid about losing my data, especially vaultwarden in this case, so I wanted to use syncthing to have it in multiple servers/clients in my local networks. But first thing is it really necessary to have that much command/software (docker backup + duplicati + syncthing) to do that ?  
And moreover, if I get a ransomware on my Rpi 4, is this ransomware is going to infect every servers where vaultwarden backup is ?

And last thing last, I use this docker command to restore my data (manually) :

> docker run --rm --volumes-from bitwarden -v $(pwd):/backup ubuntu bash -c “cd CONTAINERPATH && tar xvf /backup/backup.tar --strip 1”

(I use **ubuntu** image on this one because it doesn’t work with busybox)  
But I don’t know when to do this command, after I pulled the vaultwarden image ? After I created the volume for vaultwarden ? After I started the vaultwarden container and created the volume ?

Thanks in advance for your time

---

<div class="post-metadata">

**Author:** ![LostSoulfly](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@LostSoulfly](https://vaultwarden.discourse.group/u/LostSoulfly)\
**Post date:** [February 11, 2022, 3:14pm UTC](https://vaultwarden.discourse.group/t/backing-up-docker-volume-of-vaultwarden/1452/2 "2022-02-11T15:14:44Z")

</div>

This is a minor concern of mine and this is how I approach it.

I run a scheduled task nightly that creates a backup of the database and adds it to a zip file. I also copy the backup to a different HDD on the same server as well as another local server, but the zip file is also backed up by Dropbox. Security isn’t really a concern of mine since the database is already encrypted but you could use 7z or something to add a password to the zip file.

Here’s a quick example…

```auto
\\dockerhost\appdata\bitwarden\sqlite3.exe \\dockerhost\appdata\bitwarden\db.sqlite3 ".backup '\\dockerhost\appdata\bitwarden\db-backup\backup$(get-date -f yyyy-MM-dd_mm).sqlite3'"
Compress-Archive -Path "\\dockerhost\appdata\bitwarden\db-backup\backup$(get-date -f yyyy-MM-dd_mm).sqlite3" -Update -DestinationPath "C:\Users\Administrator\Desktop\Dropbox\Backup\BitWarden\backup.zip"

$filepath = "\\dockerhost\appdata\bitwarden\db-backup\"
$filetype = "*.sqlite3"
$file_count = [System.IO.Directory]::GetFiles("$filepath", "$filetype").Count

If ($file_count -gt 30) {
Get-ChildItem \\dockerhost\appdata\bitwarden\db-backup | Sort CreationTime | Select -First 1 | Remove-Item
}

```
