[GH-ISSUE #247] Add cron job for sql backup for docker image #124

Closed
opened 2026-03-03 01:25:31 +03:00 by kerem · 6 comments
Owner

Originally created by @ghost on GitHub (Nov 13, 2018).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/247

Hi all,

Is it possible to add cron job for sql backup in docker image? Everytime I want update container I need to do database backup manually, it would be better to have cron job for this inside container running every hour or day or possibility to configure this variable during container configuration.

Originally created by @ghost on GitHub (Nov 13, 2018). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/247 Hi all, Is it possible to add cron job for sql backup in docker image? Everytime I want update container I need to do database backup manually, it would be better to have cron job for this inside container running every hour or day or possibility to configure this variable during container configuration.
kerem closed this issue 2026-03-03 01:25:31 +03:00
Author
Owner

@strayer commented on GitHub (Nov 13, 2018):

You essentially have two options, both require a container to share the volume that bitwarden_rs uses.

A) Run a sqlite container periodically via the Docker hosts crontab
B) Build a container with a cron daemon (e.g. dcron) and run the sqlite backup command in it

Option A is trivial, option B is a little more complicated since its horribly annoying getting a cron daemon to work correctly in a Docker container. I'm technically doing something similar than option A… I'm rebuilding and restarting all containers on my hosts daily with a cronjob anyway to cover potential security updates and simply run the sqlite backup before, directly on the Docker host.

This obviously doesn't work on a Kubernetes/Docker Swarm setup, but then again… if you are running a cluster you should be able to get option B running easily.

<!-- gh-comment-id:438181731 --> @strayer commented on GitHub (Nov 13, 2018): You essentially have two options, both require a container to share the volume that bitwarden_rs uses. A) Run a sqlite container periodically via the Docker hosts crontab B) Build a container with a cron daemon (e.g. dcron) and run the sqlite backup command in it Option A is trivial, option B is a little more complicated since its horribly annoying getting a cron daemon to work correctly in a Docker container. I'm technically doing something similar than option A… I'm rebuilding and restarting all containers on my hosts daily with a cronjob anyway to cover potential security updates and simply run the sqlite backup before, directly on the Docker host. This obviously doesn't work on a Kubernetes/Docker Swarm setup, but then again… if you are running a cluster you should be able to get option B running easily.
Author
Owner

@ghost commented on GitHub (Nov 13, 2018):

I am asking about B). There is a docker image but without cron job https://hub.docker.com/r/mprasil/bitwarden/

<!-- gh-comment-id:438182295 --> @ghost commented on GitHub (Nov 13, 2018): I am asking about B). There is a docker image but without cron job https://hub.docker.com/r/mprasil/bitwarden/
Author
Owner

@mprasil commented on GitHub (Nov 13, 2018):

We're not going to add cron (and other related utilities) into the bitwarden_rs image to keep the image relatively simple and small.

There's a ton of images with cron out there, you can just use those and mount the same volume your bitwarden_rs server is using.

Hope that makes sense.

<!-- gh-comment-id:438195084 --> @mprasil commented on GitHub (Nov 13, 2018): We're not going to add cron (and other related utilities) into the bitwarden_rs image to keep the image relatively simple and small. There's a ton of images with cron out there, you can just use those and mount the same volume your bitwarden_rs server is using. Hope that makes sense.
Author
Owner

@mprasil commented on GitHub (Nov 13, 2018):

Having said that, if someone feels like writing a documentation about how to achieve cron backup with external container and shared volume, the PR would be very appreciated.

<!-- gh-comment-id:438195752 --> @mprasil commented on GitHub (Nov 13, 2018): Having said that, if someone feels like writing a documentation about how to achieve cron backup with external container and shared volume, the PR would be very appreciated.
Author
Owner

@Bruceforce commented on GitHub (Nov 17, 2018):

Having said that, if someone feels like writing a documentation about how to achieve cron backup with external container and shared volume, the PR would be very appreciated.

@mprasil Would something like this be useful for the documentation?
https://gitlab.com/1O/bitwarden_rs-backup/tree/master

I outlined an automatic and a manual solution there.

<!-- gh-comment-id:439566463 --> @Bruceforce commented on GitHub (Nov 17, 2018): > Having said that, if someone feels like writing a documentation about how to achieve cron backup with external container and shared volume, the PR would be very appreciated. @mprasil Would something like this be useful for the documentation? https://gitlab.com/1O/bitwarden_rs-backup/tree/master I outlined an automatic and a manual solution there.
Author
Owner

@mprasil commented on GitHub (Nov 17, 2018):

I think it would! You can create a PR to update the readme and link to your repo or something like that.

<!-- gh-comment-id:439605059 --> @mprasil commented on GitHub (Nov 17, 2018): I think it would! You can create a PR to update the readme and link to your repo or something like that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#124
No description provided.