Self Hosted Docker Bitwarden

Hello,

I spend too many hours trying to make the bitwarden self hosted docker being accessible on my LAN. I never used docker before so I don’t understand why it’s create a whole new subnet under 172.18.x.x instead of just binding to the host IP of the server.

Can someone direct me to the right direction as to make the bitwarden server use the server’s ip and bind to the server port so I can connect to bitwarden on my LAN? I’m running Ubuntu 20.04

Thanks

Bitwarden server deployment is designed to support Windows, macOS, and Linux. Docker host networking drivers only support Linux, so it makes sense they would use a bridge network.


I don’t self-host Bitwarden, so you can wait for someone else to comment on exact specifics for Bitwarden.


Discussing Docker, in theory the exposed ports of nginx container should get traffic from server’s port 80 & 443 (or whatever you configured) to the docker container as long as you open the ports on your host machine and just use the IP address (or corresponding domain name) of the host machine on your LAN.

Once your self-host instance is up, try checking:

  1. Docker containers are running and nginx container has ports

    docker ps

  2. Port 443 is open on your server using a command like:

    netstat -anp | grep :443

    And make sure docker instance is properly listening on server’s port. You may also want to make sure IP allows for traffic (e.g. probably 0.0.0.0 for all traffic or <LAN IP> for traffic sent on LAN, etc.)

  3. Your firewall status to make sure ports 80 and 443 are not blocked. I think Ubuntu uses: sudo ufw status

  4. Afterward, you might want to start by trying to reach your self-hosted Bitwarden on your server. Then, try using another device on LAN.


Trying to change network setting for host networking is probably going to be trickier and I don’t know if Bitwarden will still work properly with it. For Docker on Linux, you can try changing docker-compose to use network_mode: "host". May also need to modify actual docker run commands if there are any that are run outside docker-compose.

You will probably need to bring up Bitwarden as manual install: Install and Deploy Manually | Bitwarden Help & Support