How to self-host Bitwarden using Docker

This article explains how to self-host Bitwarden using Docker. Bitwarden is a widely adopted password management solution that enables you to securely store and manage your credentials.

What you need

Before starting, ensure you meet these requirements:

  • Docker-CE installed on your server
  • A domain name pointed to your server’s IP address

Technologies used in this guide

  • Hetzner Cloud Server (image: Docker-CE pre-installed)
  • Docker & Docker Compose for containerized deployment
  • Bitwarden

Note: We’ll use Hetzner Cloud as our hosting provider, but you can use any other provider as well, that comes with a pre-installed version of Docker CE or where you can self-install Docker-CE.

Step 1: Prepare the server

In this step, you will:

  1. Update the system packages.
  2. Install the Docker Compose plugin.

Run the following commands on your server via SSH:

Bash
# Update the system packages
apt update && apt -y upgrade

# Install Docker Compose plugin
apt install docker-compose-plugin

Step 2: Install Bitwarden

Note: Before you install Bitwarden, you can optionally create a Bitwarden local user and directory, read more on that here.

To install Bitwarden, copy and paste the following command:

Bash
curl -Lso bitwarden.sh "https://func.bitwarden.com/api/dl/?app=self-host&platform=linux" && chmod 700 bitwarden.sh

Step 3: Run the installer script

A ./bwdata directory willl be created relative to the location of bitwarden.sh.

Bash
./bitwarden.sh install

Step 4: Installment process

Now follow the instructions displayed in the terminal.

Domain Name:
Enter the domain name for your Bitwarden instance. This should match your configured DNS record.

Let’s Encrypt:
Enter y to generate a free, trusted SSL certificate with Let’s Encrypt. You’ll be prompted for an email address for certificate expiration reminders. If you prefer to use your own SSL certificate, enter n.

Installation ID:
Provide your installation id, which you can retrieve from bitwarden.com/host using a valid email address. For details, see the related documentation.

Installation Key:
Enter your installation key, available from bitwarden.com/host using a valid email. Refer to the documentation for more information.

Region (US/EU):
Specify US or EU based on the cloud server used to license paid features. This applies only if connecting a self-hosted account or organization to a paid subscription.

Using an SSL Certificate:
If you already have an SSL certificate, enter y and place the certificate files in the ./bwdata/ssl/your.domain directory. You’ll then be asked if the certificate is trusted. Alternatively, enter n to use a self-signed certificate.

Self-Signed SSL Certificate:
Enter y to generate a self-signed certificate for testing purposes. If you enter n, your instance will run without an SSL certificate, and you’ll need to front it with an HTTPS proxy to ensure Bitwarden functions properly.

Once the process is done, you can access your Bitwarden installation under your domain (e.g., bitwarden.example.com).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

How to self-host Bitwarden using Docker

About the author