[GH-ISSUE #287] [Docker] Unable to connect to database when using non-root user #154

Closed
opened 2026-03-03 01:25:58 +03:00 by kerem · 5 comments
Owner

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

I wanted to use non-root user and container didn't start.

bitwarden_1  | thread 'main' panicked at 'Can't conect to DB: BadConnection("Unable to open the database file")', src/libcore/result.rs:1009:5
Originally created by @JuniorJPDJ on GitHub (Dec 13, 2018). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/287 I wanted to use non-root user and container didn't start. ``` bitwarden_1 | thread 'main' panicked at 'Can't conect to DB: BadConnection("Unable to open the database file")', src/libcore/result.rs:1009:5 ```
kerem 2026-03-03 01:25:58 +03:00
Author
Owner

@dani-garcia commented on GitHub (Dec 17, 2018):

I'm not very knowledgeable in docker, but I imagine this is because the non-root user doesn't have permission in the data folder.

<!-- gh-comment-id:447950623 --> @dani-garcia commented on GitHub (Dec 17, 2018): I'm not very knowledgeable in docker, but I imagine this is because the non-root user doesn't have permission in the data folder.
Author
Owner

@bassarf commented on GitHub (Jan 16, 2019):

As far as I know, and as far as my 2 minute google research goes, this is a docker thing.
The docker deamon runs as root. But on the docker website there is a manual for non-root users to manage docker: https://docs.docker.com/install/linux/linux-postinstall/

IMO this issue should be closed because it is not specific to bitwarden_rs but rather being a docker thing

<!-- gh-comment-id:454905193 --> @bassarf commented on GitHub (Jan 16, 2019): As far as I know, and as far as my 2 minute google research goes, this is a docker thing. The docker deamon runs as root. But on the docker website there is a manual for non-root users to manage docker: https://docs.docker.com/install/linux/linux-postinstall/ IMO this issue should be closed because it is not specific to bitwarden_rs but rather being a docker thing
Author
Owner

@JuniorJPDJ commented on GitHub (Jan 16, 2019):

@bassarf that issue is not about starting container as non-root user, it's about dropping privileges of bitwarden_rs running in docker container to other (non-root) user.
Still, thank you for your interest, my description was misleading.

<!-- gh-comment-id:454961234 --> @JuniorJPDJ commented on GitHub (Jan 16, 2019): @bassarf that issue is not about starting container as non-root user, it's about dropping privileges of bitwarden_rs running in docker container to other (non-root) user. Still, thank you for your interest, my description was misleading.
Author
Owner

@Sohalt commented on GitHub (Feb 3, 2019):

You will have to set the correct permissions on the /data volume. In addition you need to adjust the ROCKET_PORT to something above 1024, as everything below is a privileged port and can only be opened by root.

<!-- gh-comment-id:460013030 --> @Sohalt commented on GitHub (Feb 3, 2019): You will have to set the correct permissions on the `/data` volume. In addition you need to adjust the `ROCKET_PORT` to something above 1024, as everything below is a privileged port and can only be opened by root.
Author
Owner

@mprasil commented on GitHub (Feb 24, 2019):

I've documented the procedure in wiki page, so I believe this is resolved. I ran the container as nobody following the wiki, but feel free to re-open or open new issue if you encounter any problems.

<!-- gh-comment-id:466759686 --> @mprasil commented on GitHub (Feb 24, 2019): I've documented the procedure in [wiki page](https://github.com/dani-garcia/bitwarden_rs/wiki/Running-docker-container-with-non-root-user), so I believe this is resolved. I ran the container as `nobody` following the wiki, but feel free to re-open or open new issue if you encounter any problems.
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#154
No description provided.