Linux

Self-Host Vaultwarden with Docker

In this tutorial, we are going to teach you how you can quickly and efficiently have the Vaultwarden password manager running on your machine by using Docker engine.
Captain Salem 2 min read
Self-Host Vaultwarden with Docker

Vaultwarden, formerly known as Bitwarden_RS is a free an open-source server implementation of the Bitwarden password manager.

If you are not familiar, Bitwarden is an extremely feature rich and popular password manager that allows you to store your credentials in a secure manner. It also allows you to access your credentials such as passwords and sensitive information from any device.

Although Bitwarden does provide a free version of the service, at the time of writing, it does require a paid subscription to get access to the full features. Vaultwarden is designed to be an alternative to Bitwarden offering a self-hosted instance and absolute control over personal data.

Some of the noticeable features of Vaultwarden include:

  1. Self-hosting
  2. Heavy encryption
  3. Multi-platform.
  4. Extensive Browser extension support
  5. Open-Source

Prerequisites

This tutorial follows a fundamental format for setting up Vaultwarden as Docker container. However, ensure you have the following:

  1. A Linux, macOS or Windows host
  2. Docker Engine version 23 and above installed on the host.
  3. Sufficient permissions to run Docker containers.

With the above requirements met, we can proceed and discuss how to configure Vaultwarden.

Docker Pull Vaultwarden Image

The first step is to download the Vaultwarden image on the host machine. We can do this by running the docker pull command as:

$ docker pull vaultwarden/server:latest

This should download the latest version of the Vaultwarden image on your machine and allow you to create containers from the image.

Docker Create Vaultwarden Container

Once we have downloaded the image, we can proceed and use the docker run command to create a container using the image. The command is as shown:

$ docker run -d --name vaultwarden -v /vw-data/:/data/ -p 80:80 vaultwarden/server:latest

Once you run the above command, Docker will create a container using the Vaultwarden image. It will also preserver any persistent data under /vw-data and map port 80 on your host machine.

Configuring Vaultwarden

Once the container is running, open your browser and follow the address

http://localhost

This will prompt you to login or create a new account for your Vaultwarden instance.

Since we are setting up the Vaultwarden instance for the first time, select create account to setup a new account on the server.

In this section, provide all the details for your account such as the email, username, and master password.

Click create account to setup the account with the provided details. Once done, click login and login to the web interface with the specified credentials.

NOTE: In some cases, Vaultwarden will prevent you from logging into the vault without an SSL certificate. You can configure the container to use HTTPS by setting the SSL certificate details as shown:

docker run -d --name bitwarden \
-e ROCKET_TLS='{certs="/ssl/certs.pem",key="/ssl/key.pem"}' \
-v /ssl/keys/:/ssl/ \
-v /vw-data/:/data/ \
-p 443:80 \
vaultwarden/server:latest

Ensure the specified certificate files exists before running the command above. You can learn more about configuring HTTPS for your vault in the resource below:

https://github.com/dani-garcia/vaultwarden/wiki/Enabling-HTTPS

Conclusion

This tutorial provides the basic features of quickly setting up and running a Vaultwarden instance using Docker containers.

Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.