
Squashed commit of the following: commit f3d42ceebe3f209645dc44b9e1ea956339c32968 Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:48:23 2021 +0100 Only build master since rpi3 is no longer needed commit 32e213d65955291fa38d20c77e74aa30cf25cd24 Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:46:40 2021 +0100 Added dockerhub login commit 960c44c7148073cfbee617be3019fb399d1fc0b1 Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:38:21 2021 +0100 Added ARCH to Dockerfile commit fad35cd700dcf7a4c4ee5ac7eeea89f33871eaab Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:30:30 2021 +0100 don't push in buildx commit 9cd85b6787ec552d5dee393a40137fa3ed9cb94e Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:28:09 2021 +0100 added context commit 07fb2b320463dc495c4e69f40bb524bcc0ebd15a Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:20:02 2021 +0100 Added experimental commit 99b352dad13aca54f49fb56f0fb19a921cd81c9d Author: 1O <2408212-1O@users.noreply.gitlab.com> Date: Sun Jan 24 19:16:59 2021 +0100 Added buildx
bitwarden_rs Backup
Docker Containers for bitwarden_rs Backup.
Usage
The default tag latest
should be used for a x86-64 system. If you try to run the container on a raspberry pi 3 you should use the tag rpi3
. Also make sure that your bitwarden_rs container is named bitwarden
otherwise you have to replace the container name in the --volumes-from
section of the docker run
call.
Automatic Backups
A cron daemon is running inside the container and the container keeps running in background.
Start backup container with default settings (automatic backup at 5 am)
docker run -d --restart=always --name bitwarden_backup --volumes-from=bitwarden bruceforce/bw_backup
Example for hourly backups
docker run -d --restart=always --name bitwarden_backup --volumes-from=bitwarden -e CRON_TIME="0 * * * *" bruceforce/bw_backup
Example for backups that delete after 30 days
docker run -d --restart=always --name bitwarden_backup --volumes-from=bitwarden -e DELETE_AFTER=30 bruceforce/bw_backup
Manual Backups
You can use the crontab of your host to schedule the backup and the container will only be running during the backup process.
docker run --rm --volumes-from=bitwarden bruceforce/bw_backup manual
Keep in mind that the above command will be executed inside the container. So
$DB_FILE
is the path to the bitwarden database which is normally locatated at/data/db.sqlite3
$BACKUP_FILE
can be any place inside the container. Easiest would be to set it to/data/backup.sqlite3
which will create the backup near the original database file. If you want the backed up file to be stored outside the container you have to mount a directory by adding-v <PATH_ON_YOUR_HOST>:<PATH_INSIDE_CONTAINER>
. The complete command could look like this
docker run --rm --volumes-from=bitwarden -e UID=0 -e BACKUP_FILE=/myBackup/backup.sqlite3 -e TIMESTAMP=true -v /tmp/myBackup:/myBackup bruceforce/bw_backup manual
Environment variables
ENV | Description |
---|---|
DB_FILE | Path to the Bitwarden sqlite3 database inside the container |
BACKUP_FILE | Path to the desired backup location inside the container |
BACKUP_FILE_PERMISSIONS | Sets the permissions of the backup file (CAUTION 1) |
CRON_TIME | Cronjob format "Minute Hour Day_of_month Month_of_year Day_of_week Year" |
TIMESTAMP | Set to true to append timestamp to the BACKUP_FILE |
UID | User ID to run the cron job with |
GID | Group ID to run the cron job with |
LOGFILE | Path to the logfile inside the container |
CRONFILE | Path to the cron file inside the container |
DELETE_AFTER | Delete old backups after X many days |
Common erros
Wrong permissions
Error: unable to open database file
is most likely caused by permission errors.
Note that sqlite3 creates a lock file in the source directory while running the backup.
So source AND destination have to be +rw for the user. You can set the user and group ID
via the UID
and GID
environment variables like described above.
Wrong timestamp
If you need timestamps in your local timezone you should mount /etc/timezone:/etc/timezone:ro
and /etc/localtime:/etc/localtime:ro
like it's done in the docker-compose.yml.
-
The permissions should at least be 700 since the backup folder itself gets the same permissions and with 600 it would not be accessible. ↩︎