Can't backup database file from docker container #124

Closed
opened 2026-02-04 17:39:42 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @ghost on GitHub (Nov 13, 2018).

Running this inside container gets me error:

root@Bitwarden:/# sqlite3 /data/db.sqlite3 ".backup '/backup/backup.sqlite3'"
bash: sqlite3: command not found
Originally created by @ghost on GitHub (Nov 13, 2018). Running this inside container gets me error: ``` root@Bitwarden:/# sqlite3 /data/db.sqlite3 ".backup '/backup/backup.sqlite3'" bash: sqlite3: command not found ```
Author
Owner

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

Mount /data/ on Host and run sqlite-Backup from there. It works fine here.

@geimist commented on GitHub (Nov 13, 2018): Mount /data/ on Host and run sqlite-Backup from there. It works fine here.
Author
Owner

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

It should not works like this, sqlite3 command should be running inside the container, I dont't want to mount anything on my host or instal any apps

@ghost commented on GitHub (Nov 13, 2018): It should not works like this, sqlite3 command should be running inside the container, I dont't want to mount anything on my host or instal any apps
Author
Owner

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

@Haxy89 as I've suggested in #247, you should backup from another container that will have sqlite3 installed. This way you don't have to install anything on the host. Something like this image should work. You should be able to just run this to create backup:

docker run \
  --volumes-from=bitwarden \
  tcgerlach/sqlite \
  sqlite3 /data/db.sqlite3 ".backup /data/db-backup/backup.sqlite3"

This wasn't tested, so it's probably not exactly right, but I hope you get the idea how to proceed from here.

I understand it might complicate the setup a bit in some cases, (like yours) but I'm trying to keep the image as minimal as possible.

@mprasil commented on GitHub (Nov 13, 2018): @Haxy89 as I've suggested in #247, you should backup from another container that will have sqlite3 installed. This way you don't have to install anything on the host. Something like [this image](https://hub.docker.com/r/tcgerlach/sqlite/) should work. You should be able to just run this to create backup: ```bash docker run \ --volumes-from=bitwarden \ tcgerlach/sqlite \ sqlite3 /data/db.sqlite3 ".backup /data/db-backup/backup.sqlite3" ``` This wasn't tested, so it's probably not exactly right, but I hope you get the idea how to proceed from here. I understand it might complicate the setup a bit in some cases, (like yours) but I'm trying to keep the image as minimal as possible.
Author
Owner

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

@mprasil
I understand you are trying to keep the image as minimal as possible but I don't think adding one package (sqlite3) will increase size too much.

Despite this I will try to setting another container only for backup bitwarden database.

Thanks for bitwarden and docker image, great work.

@ghost commented on GitHub (Nov 13, 2018): @mprasil I understand you are trying to keep the image as minimal as possible but I don't think adding one package (sqlite3) will increase size too much. Despite this I will try to setting another container only for backup bitwarden database. Thanks for bitwarden and docker image, great work.
Author
Owner

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

Actually while the size is somewhat a concern, but mostly I'd like to get to a stage where we will be building "distroless" images, so there will be absolutely no packages to install.

I'm thinking that maybe we could create "fat" version of the image with cron, nginx and sqlite present that would do a lot of things for you. But I guess the first step is to agree on what should be in such image as people have quite different expectations.

@mprasil commented on GitHub (Nov 13, 2018): Actually while the size is somewhat a concern, but mostly I'd like to get to a stage where we will be building "distroless" images, so there will be absolutely no packages to install. I'm thinking that maybe we could create "fat" version of the image with cron, nginx and sqlite present that would do a lot of things for you. But I guess the first step is to agree on what should be in such image as people have quite different expectations.
Author
Owner

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

Create the 'fat' version is something we should consider for sure.
For me would be great to have cron, sqlite and nginx proxy for notification already configured inside

@ghost commented on GitHub (Nov 13, 2018): Create the 'fat' version is something we should consider for sure. For me would be great to have cron, sqlite and nginx proxy for notification already configured inside
Author
Owner

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

To be fair, this is what many people consider as using Docker containers the wrong way. Its easy to use the bitwarden_rs image in a docker-compose (or Kubernetes) environment and adding dedicated containers with their own images for nginx and cron+sqlite and wiring them up with volumes and networks.

@strayer commented on GitHub (Nov 13, 2018): To be fair, this is what many people consider as using Docker containers the wrong way. Its easy to use the bitwarden_rs image in a docker-compose (or Kubernetes) environment and adding dedicated containers with their own images for nginx and cron+sqlite and wiring them up with volumes and networks.
Author
Owner

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

Its not always easy to use docker-compose or Kubernetes.
For me I am limited by my docker host process - Qnap NAS

@ghost commented on GitHub (Nov 13, 2018): Its not always easy to use docker-compose or Kubernetes. For me I am limited by my docker host process - Qnap NAS
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#124