I want to use an external database!

Hi,

I just setup bitwardenrs fine on raspberry pi as a docker container… Bcs I don’t want to rely on my sd card to store the database, i want bitwardenrs to connect to an external MariaDB 10 databse on my nas. (My nas doesn’t support docker). They are in the same local network btw.

How do I do this? I read something about an .env file, but I can’t find it…

Mvg,
Ferre

Have you seen these instructions?

1 Like

I’am just new to docker, how can I add this database variable to my existing container?

You will need to stop the container and then relaunch it; it can’t be added to an already running container.

I tried to stop the container and then to restart it with variable. I can’t get it to work… maybe you have an exemple? The bitwarden instance is working fine, I just want to replace the database with an external one. (It can stay empty!, doesn’t need to recover anything from existent database!)

Sure, here’s an example from the Wiki page:

docker run -d --name bitwarden --net
-v $(pwd)/bw-data/:/data/ -v :/ssl/
-p 443:80 -e ROCKET_TLS=‘{certs=“/ssl/”,key=“/ssl/”}’
-e RUST_BACKTRACE=1 -e DATABASE_URL=‘mysql://<bitwarden_user>:<bitwarden_pw>@mysql/bitwarden’
-e ADMIN_TOKEN=<some_random_token_as_per_above_explanation>
-e ENABLE_DB_WAL=‘false’

But the example isn’t important. What would be better is showing us what you’re trying and what errors you’re experiencing.

The problem I’m experiencing is that I’m running this bitwarden_rs container as an addon of homeassistant. This automatically makes a container and runs it. I can ssh into this machine and when I run ‘docker container list’ I see this:

This perfectly works and when I attach to it, I can see that there is a data folder with db.sqlite3.
So now I’m just trying to find out how to reconfigure this container with the external database.
They are in the same network!
The bitwarden host ip: 192.168.0.2, Nas host ip: 192.168.0.6
Nas running MariaDB10
Already created database and user with SQL from Wiki Page

2Can

Not being familiar with Home Assistant, so take this with a grain of salt. Browsing through the add-on’s docs for installation (addon-bitwarden/DOCS.md at main · hassio-addons/addon-bitwarden · GitHub) it doesn’t seem that there’s support for modifying HOW the container is launched. Perhaps this is possible within Home assistant, it’s just not something familiar with. (I have no idea if you’re launching home assistant itself with docker, and from within HA launching bitwarden, or if you have a docker-compose.yml that launches both…)

I’d suggest reaching for support on the home assistant add-on page first if you want to stick with home assistant. Ultimately you just want to add an environment variable to the container’s launch parameters.
Failing that, you can ditch the add-on and just launch the container yourself manually.

Thankyou for your answer!
There is also the possibilty to remove the addon and use the portainer instance?
Maybe I can launch the container there manually?

2Can

Hi,

I’m doing great right know I think. As you suggested, I installed the container manually. I also added the database variable. Know I’m just getting this error…

The connection to the databse is working I think.

2Can