Self-Host Vaultwarden Docker: A Step-by-Step VPS Guide

A password manager that lives on your own VPS is one less subscription to worry about, and your vault never leaves hardware you control. To self-host Vaultwarden Docker style, you need one Docker container, one compose file, and about ten minutes. This guide walks you through the whole setup on a typical Ubuntu VPS: compose configuration, admin token, HTTPS reverse proxy, account creation, backups, and updates.

What Is Vaultwarden and Why Self-Host It?

Vaultwarden is a lightweight, community-written server that speaks the Bitwarden protocol. It is not the official Bitwarden product; it is an independent implementation that works with the official Bitwarden clients: the browser extensions, the desktop apps, the mobile apps, and the web vault. Because the API is compatible, your familiar Bitwarden clients keep working against your own server.

The draw is simple. You rent a VPS already, so running one more container costs nothing extra, and your encrypted vault sits in a SQLite file inside a volume you can see and back up yourself. There is no monthly per-user fee on your side, since the software is open source. You also control the update schedule instead of waiting on someone else’s roadmap.

The trade-off is honest, too: security becomes your job. A weak admin token, an exposed HTTP-only endpoint, or missing backups will hurt you more than any cloud provider outage. The steps below cover all three.

Prerequisites

  • A VPS running Ubuntu 22.04 or 24.04 with at least 1 GB of RAM. The Vaultwarden container itself is small (under 200 MB RAM in normal use).
  • Docker and the Docker Compose plugin installed. If they are missing, see our guide on installing Docker Compose on Ubuntu.
  • A domain or subdomain pointing at your VPS, for example vault.example.com. Browsers and the Bitwarden clients require HTTPS, so you will not skip this part.
  • SSH access with sudo, plus a firewall (UFW is fine) allowing ports 22, 80, and 443 only.

Install and Self-Host Vaultwarden Docker with Compose

Most tutorials paste a long docker run command. A compose file is easier to read, version, and update, so that is what we will use.

Create the project folder and compose file

mkdir -p /opt/vaultwarden && cd /opt/vaultwarden
nano docker-compose.yml

Paste this Vaultwarden docker compose configuration:

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    environment:
      - DOMAIN=https://vault.example.com
      - SIGNUPS_ALLOWED=true
      - ADMIN_TOKEN=PASTE_YOUR_TOKEN_HERE
      - WEBSOCKET_ENABLED=true
    volumes:
      - ./vw-data:/data
    ports:
      - "127.0.0.1:8080:80"

Three things to note:

  • DOMAIN must be the public HTTPS address of your vault, with no trailing slash. Set it now even before the reverse proxy is live; Vaultwarden uses it to build links in emails and invitations.
  • SIGNUPS_ALLOWED=true is temporary. You need it on to create your first account, and you will switch it off right after.
  • The container listens on 127.0.0.1:8080, not on a public interface. Nothing reaches Vaultwarden directly from the internet; all traffic goes through the reverse proxy you configure next.

Generate the admin token

The admin panel is the only place to manage users and settings after signups are disabled, so its token needs to be long and random. Generate one with OpenSSL:

openssl rand -base64 48

Copy the output and replace PASTE_YOUR_TOKEN_HERE in the compose file. Store the token in your own password manager or a note file with restricted permissions, for example chmod 600 ~/vaultwarden-admin-token.txt.

Start the container

docker compose up -d
docker compose logs -f vaultwarden

You should see a line saying the server started and is listening. Press Ctrl+C to leave the logs. Confirm the SQLite database file appeared:

ls -lh /opt/vaultwarden/vw-data/db.sqlite3

Put a Reverse Proxy in Front (HTTPS Is Required)

This step is not optional. Bitwarden clients refuse to talk to a vault over plain HTTP in most real-world setups, and sending a master password over an unencrypted connection would be reckless anyway. A Vaultwarden reverse proxy HTTPS setup takes five minutes with Nginx and Certbot.

sudo apt install -y nginx certbot python3-certbot-nginx

Create /etc/nginx/sites-available/vault.example.com:

server {
    listen 80;
    server_name vault.example.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /notifications/hub {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

The /notifications/hub block enables WebSocket live sync, so changes made on one device appear on the others without a manual sync. Enable the site and get the certificate:

sudo ln -s /etc/nginx/sites-available/vault.example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d vault.example.com

Open https://vault.example.com in a browser. You should see the Vaultwarden web vault login page with a valid certificate.

Create Your Account, Then Lock the Door

With SIGNUPS_ALLOWED=true still set, click “Create Account” in the web vault and register your user. Log in once to confirm the vault loads and syncs.

Now disable public registration. This is the step people skip, and it is the one that keeps strangers from creating accounts on your server:

cd /opt/vaultwarden
sed -i 's/SIGNUPS_ALLOWED=true/SIGNUPS_ALLOWED=false/' docker-compose.yml
docker compose up -d

Visit the admin panel at https://vault.example.com/admin and paste your Vaultwarden admin token. From there you can see users, revoke sessions, and adjust settings without touching the compose file again.

Point your Bitwarden clients (browser extension, phone, desktop) at your server by editing the self-hosted server URL field in each client to https://vault.example.com, then log in normally.

Back Up Your Vaultwarden SQLite Database

All Vaultwarden data lives in /opt/vaultwarden/vw-data/db.sqlite3. A good Vaultwarden backup SQLite routine copies the database while the container is running, using SQLite’s own online backup so the file is never half-written:

docker exec vaultwarden sqlite3 /data/db.sqlite3 ".backup '/data/db-backup.sqlite3'"
cp /opt/vaultwarden/vw-data/db-backup.sqlite3 /root/backups/vaultwarden-$(date +%F).sqlite3

Schedule it with cron so it runs every night:

0 3 * * * docker exec vaultwarden sqlite3 /data/db.sqlite3 ".backup '/data/db-backup.sqlite3'" && cp /opt/vaultwarden/vw-data/db-backup.sqlite3 /root/backups/vaultwarden-$(date +%F).sqlite3

Keep at least one backup off the VPS itself, for example on your home machine or an object storage bucket. A backup that only exists on the same disk as the server is one disk failure away from being useless. Test a restore once, on a scratch machine, before you trust the routine.

Update Vaultwarden

Vaultwarden ships fixes regularly, and a password server is exactly the service you want patched. Check the admin panel or the container logs for the running version, then update in place:

cd /opt/vaultwarden
docker compose pull
docker compose up -d

Updates take under a minute and your data survives them because it lives in the vw-data volume, not in the image. Run a manual backup right before updating, the same way you would before any maintenance.

Security Checklist Before You Call It Done

  • Signups are disabled (SIGNUPS_ALLOWED=false).
  • Admin token is long, random, and stored offline.
  • HTTPS everywhere; the HTTP server block redirects to HTTPS (Certbot adds this automatically).
  • Firewall only opens 22, 80, and 443.
  • Nightly backups run and one copy lives off the VPS.
  • You know the update command by heart: docker compose pull && docker compose up -d.

FAQ

Is Vaultwarden the same as Bitwarden?

No. Vaultwarden is a community project that implements the Bitwarden server API. It is compatible with the official clients, but it is developed independently and is not endorsed by Bitwarden.

How much does it cost to self-host?

The software is free and open source. Your only cost is the VPS you already run, plus the domain if you do not have one. Check your hosting provider’s official pricing for current VPS rates.

Can I use the official Bitwarden apps?

Yes. In each client, choose the self-hosted server option and enter your vault URL. Extensions, desktop apps, mobile apps, and the CLI all work.

Conclusion

You now have a private password vault on your own infrastructure: compose file in version control, HTTPS in front, signups closed, and backups running. The total ongoing work is a backup check now and then and a docker compose pull when new releases land. That is the whole deal with self-hosting: a little setup discipline in exchange for full control of your credentials.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.