How to Install Bitwarden on Docker with Docker Compose
What is Bitwarden?
Bitwarden is a free and open-source password manager designed to securely store sensitive information, such as website credentials, in an encrypted vault. It also generates strong and unique passwords for browsers or devices, enhancing your online security.
Bitwarden is widely regarded as the best free solution for those who need a secure password manager. Its open-source nature allows for transparency, and its community-driven development ensures a robust security tool that keeps evolving with the latest cybersecurity trends.
This guide will walk you through the steps required to install Bitwarden on a Linux server using Docker and Docker Compose.
Prerequisites
Before proceeding, ensure that you have the following:
- Linux Server: This can be a physical machine, a virtual machine, or a cloud server.
- Docker Installed: Docker needs to be installed on your Linux server.
- Docker Compose Installed: Docker Compose should also be installed.
If Docker and Docker Compose are not yet installed, please follow the official documentation or a reliable guide to set them up. Once these prerequisites are met, you are ready to install Bitwarden using Docker Compose.
Step-by-Step Guide to Installing Bitwarden with Docker Compose
Step 1: Prepare Your Environment
Start by organizing your Docker environment. It’s a good practice to keep all Docker-related files in a dedicated directory.
mkdir -p ~/dockers/bitwarden
- This command creates a new directory named
bitwarden
inside adockers
directory in your home folder. You can change the path to suit your preferences.
Step 2: Create the Docker Compose File
The next step is to create a docker-compose.yml
file that defines the Bitwarden service.
- Navigate to the Bitwarden Directory:Move into the directory you just created:
cd ~/dockers/bitwarden
2. Create the Docker Compose File:
Use a text editor like vi
or nano
to create a new file named docker-compose.yml
:
vi docker-compose.yml
3. Add Configuration to the Docker Compose File:
Paste the following configuration into the docker-compose.yml
file:
version: '3'
networks:
default:
name: monitoring-net
external: true
services:
bitwarden:
image: bitwardenrs/server
restart: always
ports:
- "8123:80"
volumes:
- ./bw-data:/data
environment:
WEBSOCKET_ENABLED: 'true' # Required to use websockets
SIGNUPS_ALLOWED: 'true' # Set to 'false' to disable signups
- version: Specifies the version of Docker Compose syntax to use.networks: Defines a network for the service, which allows communication between containers.services: Contains the definition of the Bitwarden service.
- image: The Docker image to use (
bitwardenrs/server
), which is a lightweight Bitwarden server. - restart: Ensures the service restarts automatically if it crashes.
- ports: Maps port 8123 on the host to port 80 in the container.
- volumes: Mounts a local directory to store persistent data.
- environment: Sets environment variables for the container, such as enabling websockets and allowing user signups.
- Save and Exit the File:If using
vi
, save and exit by pressingEsc
, then type:wq
and hitEnter
.
Step 3: Launch Bitwarden with Docker Compose
Once the Docker Compose file is ready, you can launch the Bitwarden service.
- Run Docker Compose:Execute the following command to start the service:
docker-compose up -d
- The
-d
flag runs the container in detached mode, meaning it runs in the background. - Docker Compose will download the Bitwarden image, create the necessary container, and start it up according to the configuration you provided.
Step 4: Verify the Installation
After the command completes, it’s important to verify that the Bitwarden container is running correctly.
- Check Running Containers:Use the following command to list all running Docker containers:
Use the following command to list all running Docker containers:
docker ps
This command should display your Bitwarden container with its corresponding details, including the ports mapped to your server.
2. Access Bitwarden:
Open a web browser and navigate to the following URL:
http://SERVER_IP:8123
Replace SERVER_IP
with the IP address of your server. If everything is set up correctly, you should see the Bitwarden login page.
Thank you for reading the article! If you found the information useful, you can donate using the buttons below:
Donate ☕️ with PayPalDonate 💳 with Revolut