Deploy Vaultwarden on Ubuntu 24.04 with Docker Compose

Aybars Altınyay
Aybars Altınyay
Platform Engineer & Technical Writer
IntermediateUpdated Oct 27, 202626 min read~45+ minutes total
VaultwardenDocker ComposeUbuntu 24.04Password ManagerCaddySecurityBackup
Last reviewed:
Tutorial
Deploy Vaultwarden on Ubuntu 24.04 with Docker Compose
rafftechnologies.com/learn
On this page

Prerequisites

  • An Ubuntu 24.04 VM with SSH sudo access, a domain pointed to the VM, ports 80/443 available, a tested recovery path before firewall changes, and a secure off-server backup destination

Don’t have a server yet?

Vaultwarden is a lightweight, Bitwarden-compatible password manager that you can self-host on your own server. This guide uses a Raff Linux VM running Ubuntu 24.04 with Docker Compose. Vaultwarden stays on a private Docker network, while Caddy is the only public-facing container for HTTPS.

Raff Technologies is the VM platform used by the original tutorial. The saved tested environment remains Raff VM with 2 vCPU, 4 GB DDR5 RAM, 40 GB NVMe storage, Ubuntu 24.04 LTS, kernel 6.8.x. This revision re-verifies the deployment guidance against current Vaultwarden documentation and releases on September 5, 2026 without claiming a new end-to-end machine test.

This guide pins Vaultwarden 1.37.2, the current stable release at verification time. Vaultwarden's release notes specifically require 1.37.2 for compatibility with Bitwarden clients version 2026.8.0 and newer. The deployment also uses the modern integrated WebSocket path: notifications share Vaultwarden's normal HTTP port, so the old dedicated 3012 WebSocket port and WEBSOCKET_ENABLED setting are no longer part of the recommended setup.

A password manager is security-critical infrastructure. Do not put real credentials into the vault until HTTPS works, the first account can sign in, public registration is disabled, the admin page is disabled unless intentionally required, and you have created an off-server backup.

Prerequisites:

  • Ubuntu 24.04 with SSH and sudo access
  • A domain such as vault.example.com pointing to the VM
  • Public TCP 80 and 443 available for HTTPS
  • A tested recovery path before firewall changes
  • A secure off-server destination for Vaultwarden backups

Step 1 — Verify Ubuntu, DNS, resources, and existing listeners

Confirm the operating system and architecture:

Bash
cat /etc/os-release uname -m

Check memory and free storage:

Bash
free -h df -h /

Set the hostname you plan to use and verify DNS:

Bash
export DOMAIN=vault.example.com dig +short A "$DOMAIN" dig +short AAAA "$DOMAIN"

Publish an AAAA record only when IPv6 really reaches this VM and is protected consistently.

Inspect current listeners:

Bash
sudo ss -tulpn

Ports 80 and 443 should be available for the Caddy reverse proxy. Vaultwarden itself will not publish a host port in this deployment.

Verify: Ubuntu should report 24.04, DNS should point to this server, available memory/disk should be understood, and no unexpected service should already own TCP 80 or 443.

Step 2 — Update Ubuntu and install Docker Engine with Compose v2

Update package metadata and review upgrades:

Bash
sudo apt update apt list --upgradable 2>/dev/null

Apply updates according to your maintenance policy:

Bash
sudo apt upgrade

Install the Docker repository prerequisites:

Bash
sudo apt install -y ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc

Add Docker's official repository:

Bash
sudo tee /etc/apt/sources.list.d/docker.sources >/dev/null <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") Components: stable Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/docker.asc EOF

Install Docker Engine and Compose:

Bash
sudo apt update sudo apt install -y \ docker-ce docker-ce-cli containerd.io \ docker-buildx-plugin docker-compose-plugin sudo systemctl enable --now docker

Verify:

Bash
sudo docker version docker compose version sudo docker run --rm hello-world

For a standalone walkthrough of this step, see Install Docker on Ubuntu 24.04.

Verify: Docker should be active, Compose v2 should respond, and the hello-world container should run successfully.

Step 3 — Prepare the firewall without locking out SSH

Open a second SSH session before changing firewall state.

If UFW is already active, confirm the actual SSH port is allowed and permit HTTP/HTTPS:

Bash
sudo ufw status numbered sudo ufw allow 80/tcp comment 'Vaultwarden HTTP/ACME' sudo ufw allow 443/tcp comment 'Vaultwarden HTTPS'

If UFW is currently inactive, do not blindly enable it from a single remote shell. Follow the lockout-safe flow in Set Up UFW Firewall on Ubuntu 24.04, including allowing your real SSH port before enabling the firewall.

Review the final rules:

Bash
sudo ufw status numbered

Do not open Vaultwarden port 80 separately on the host and do not open the retired WebSocket port 3012. Only Caddy will publish TCP 80 and 443.

Verify: SSH should remain reachable from the second session, 80/443 should be allowed when UFW is active, and no rule should expose port 3012 or a direct Vaultwarden application port.

Step 4 — Create the Vaultwarden deployment directory and private environment file

Create a dedicated stack directory:

Bash
sudo mkdir -p /opt/vaultwarden/{vw-data,backups} sudo chown -R "$USER":"$USER" /opt/vaultwarden cd /opt/vaultwarden chmod 700 vw-data backups

Create the environment file:

Bash
cat > .env <<'EOF' DOMAIN=vault.example.com [email protected] EOF chmod 600 .env

Replace both values with your real domain and certificate contact email.

This main deployment intentionally does not define ADMIN_TOKEN; that keeps /admin disabled. If you later need the admin interface, use Vaultwarden's Argon2-hashed-token procedure rather than a plaintext token.

Verify: /opt/vaultwarden should exist, vw-data and backups should not be group/world accessible, and .env should have mode 600.

Step 5 — Create a pinned Vaultwarden 1.37.2 Docker Compose stack

Create compose.yaml:

Bash
cat > compose.yaml <<'EOF' services: vaultwarden: image: vaultwarden/server:1.37.2 container_name: vaultwarden restart: unless-stopped environment: DOMAIN: "https://${DOMAIN}" SIGNUPS_ALLOWED: "true" SHOW_PASSWORD_HINT: "false" IP_HEADER: "X-Real-IP" LOG_LEVEL: "warn" TZ: "Etc/UTC" volumes: - ./vw-data:/data networks: - vaultwarden_net caddy: image: caddy:2 container_name: vaultwarden-caddy restart: unless-stopped depends_on: - vaultwarden ports: - "80:80" - "443:443" environment: DOMAIN: "${DOMAIN}" ACME_EMAIL: "${ACME_EMAIL}" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config networks: - vaultwarden_net networks: vaultwarden_net: driver: bridge volumes: caddy_data: caddy_config: EOF

Why pin Vaultwarden instead of using latest? A password-manager server update can include database migrations and client-compatibility changes. An exact stable tag makes the deployed version auditable and lets you review each future update deliberately.

The Vaultwarden service has no ports: block, so it is reachable only from the Compose network.

Verify: grep -n 'vaultwarden/server' compose.yaml should show 1.37.2, and the Vaultwarden service should not publish any host port.

Step 6 — Configure Caddy HTTPS and the modern WebSocket path

Create Caddyfile:

Bash
cat > Caddyfile <<'EOF' { email {$ACME_EMAIL} } {$DOMAIN} { encode zstd gzip header { Strict-Transport-Security "max-age=31536000" X-Content-Type-Options "nosniff" Referrer-Policy "same-origin" -Server } reverse_proxy vaultwarden:80 { header_up X-Real-IP {remote_host} } } EOF

Modern Vaultwarden WebSocket notifications are integrated into the normal HTTP server. Caddy's reverse_proxy supports WebSocket upgrades automatically, so do not add an old rule such as:

Text
/notifications/hub -> vaultwarden:3012

and do not add WEBSOCKET_ENABLED=true. Those belong to older Vaultwarden deployments.

Validate the Compose model before starting it:

Bash
sudo docker compose config >/dev/null && echo 'Compose config is valid'

Verify: The Caddyfile should proxy only to vaultwarden:80, Compose validation should pass, and there should be no reference to port 3012.

Step 7 — Pull, start, and verify Vaultwarden 1.37.2 over HTTPS

Pull the pinned images:

Bash
cd /opt/vaultwarden sudo docker compose pull

Start the stack:

Bash
sudo docker compose up -d

Inspect status and recent logs:

Bash
sudo docker compose ps sudo docker compose logs --tail=100 vaultwarden sudo docker compose logs --tail=100 caddy

Verify the running Vaultwarden version:

Bash
sudo docker compose exec vaultwarden /vaultwarden --version

Expected version:

Text
vaultwarden 1.37.2

Test HTTPS:

Bash
DOMAIN=$(sed -n 's/^DOMAIN=//p' .env) curl -I "https://$DOMAIN"

Vaultwarden 1.37.2 is the current stable release at this revision and upstream specifically calls it required for Bitwarden clients 2026.8.0 and newer.

Verify: Both containers should stay running, /vaultwarden --version should report 1.37.2, Caddy should obtain a trusted certificate, and the HTTPS endpoint should respond successfully.

Step 8 — Create the first account and verify client login before storing real credentials

Open:

Text
https://vault.example.com

Create the first Vaultwarden account while SIGNUPS_ALLOWED=true.

Use a unique, high-entropy master password. Do not assume the server can recover a forgotten master password; the password-manager design depends on client-side encryption. Establish your own recovery process before putting irreplaceable credentials in the vault.

After account creation:

  1. Sign out of the web vault.
  2. Sign back in.
  3. Connect one Bitwarden-compatible browser extension or desktop/mobile client to your self-hosted server URL.
  4. Create a temporary test item.
  5. Force/trigger a sync if needed.
  6. Confirm the item appears in both the web vault and the client.

Current Vaultwarden 1.37.2 release notes mention client compatibility changes around Bitwarden 2026.8.0+, so testing at least one real client is more meaningful than checking the browser page alone.

Verify: The account should log in through HTTPS, at least one supported client should connect to the self-hosted URL, and a temporary item should synchronize successfully.

Step 9 — Disable public registration immediately after onboarding

Once the intended first account exists, change:

Yaml
SIGNUPS_ALLOWED: "true"

to:

Yaml
SIGNUPS_ALLOWED: "false"

using a controlled edit:

Bash
cd /opt/vaultwarden sed -i 's/SIGNUPS_ALLOWED: "true"/SIGNUPS_ALLOWED: "false"/' compose.yaml sudo docker compose up -d

Verify the running environment:

Bash
sudo docker compose exec vaultwarden printenv SIGNUPS_ALLOWED

Expected output:

Text
false

Then open the registration page in a private/incognito browser and confirm an unknown visitor cannot create a new account.

Do not repeatedly toggle public signups for routine user onboarding. For multi-user deployments, review Vaultwarden's invitation and organization controls rather than leaving anonymous registration enabled indefinitely.

Verify: SIGNUPS_ALLOWED should report false, normal existing-user login should still work, and unauthenticated public signup should no longer be available.

Step 10 — Keep the Vaultwarden admin page disabled unless you explicitly need it

Because ADMIN_TOKEN is absent from this stack, the Vaultwarden admin interface should be disabled.

Check it:

Bash
DOMAIN=$(sed -n 's/^DOMAIN=//p' /opt/vaultwarden/.env) curl -sS "https://$DOMAIN/admin" | head

A disabled-admin response is the intended state for this guide.

If you genuinely need /admin, do not use a plaintext token. Generate an Argon2 PHC hash with the exact Vaultwarden version you run:

Bash
sudo docker run --rm -it vaultwarden/server:1.37.2 /vaultwarden hash

Vaultwarden's admin documentation recommends storing the resulting Argon2 hash as the ADMIN_TOKEN configuration value. How $ characters must be quoted/escaped depends on whether you place the value directly in Compose YAML, a Compose .env file, another environment file, or a stack manager, so follow Vaultwarden's current Enabling admin page documentation for your exact configuration method.

Also be aware that values saved through /admin are written to /data/config.json and can override environment variables on later starts. Do not mix GUI-managed configuration and Compose-managed configuration without understanding that precedence.

If you no longer need the admin page, remove both the environment token and any persisted admin_token setting in config.json according to the official documentation, then restart Vaultwarden.

Verify: For this tutorial's default architecture, /admin should stay disabled and the container logs should not report a plaintext ADMIN_TOKEN warning.

Step 11 — Create a consistent Vaultwarden backup with the built-in SQLite backup command

Vaultwarden's /data directory contains more than the database: attachments, Send data, RSA keys, configuration, and other persistent application state may also be present. Back up the full persistent dataset, but do not rely on a raw copy of an actively written SQLite database.

First create Vaultwarden's built-in consistent SQLite snapshot:

Bash
cd /opt/vaultwarden sudo docker compose exec vaultwarden /vaultwarden backup

This creates a timestamped file such as:

Text
/data/db_20260905_120000.sqlite3

Then stop Vaultwarden briefly so the non-database files are copied from a quiet state:

Bash
sudo docker compose stop vaultwarden

Create an archive that includes the generated SQLite snapshot and the rest of /data, but excludes the live SQLite database/WAL/SHM files:

Bash
BACKUP="backups/vaultwarden-$(date -u +%Y%m%d-%H%M%S).tar.gz" sudo tar \ --exclude='vw-data/db.sqlite3' \ --exclude='vw-data/db.sqlite3-wal' \ --exclude='vw-data/db.sqlite3-shm' \ -czf "$BACKUP" \ vw-data compose.yaml Caddyfile .env

Start Vaultwarden again:

Bash
sudo docker compose start vaultwarden

Inspect the archive:

Bash
sudo tar -tzf "$BACKUP" | head -n 40 sudo ls -lh "$BACKUP"

Copy the archive to a protected off-server location. Treat it as sensitive infrastructure data even though vault contents are encrypted.

Verify: The archive should contain a db_*.sqlite3 snapshot plus persistent Vaultwarden files, Vaultwarden should be running again, and at least one protected backup copy should exist outside the VM.

Step 12 — Test the restore procedure before you depend on the backup

Do not overwrite production during a routine test. Restore into a disposable VM or isolated test directory first.

For an actual recovery, stop the stack before replacing data:

Bash
cd /opt/vaultwarden sudo docker compose down

Move the current data aside rather than deleting it immediately:

Bash
sudo mv vw-data "vw-data.before-restore-$(date +%s)" sudo mkdir vw-data sudo chmod 700 vw-data

Extract your backup into a temporary directory and restore the saved vw-data contents. The built-in Vaultwarden backup file is named db_*.sqlite3; rename the intended snapshot to db.sqlite3 in the restored data directory.

Example after extraction:

Bash
sudo cp /restore/vw-data/db_20260905_120000.sqlite3 \ /opt/vaultwarden/vw-data/db.sqlite3

Make sure stale SQLite WAL/SHM files are absent when restoring a database created by Vaultwarden's backup/VACUUM process:

Bash
sudo rm -f \ /opt/vaultwarden/vw-data/db.sqlite3-wal \ /opt/vaultwarden/vw-data/db.sqlite3-shm

Restore the other persistent files/directories from the archive, then start the stack:

Bash
sudo docker compose up -d

Validate login, attachments, organization data, Send data if used, and client sync. A database-only restore is not enough when the original vault used attachments or other files under /data.

Raff Data Protection can provide VM-level recovery, while Object Storage can be an off-server target when your backup transfer tooling supports S3-compatible storage.

Verify: The restored test instance should start with the expected accounts/items, attachments should open when applicable, and a client should synchronize successfully against the restored server.

Step 13 — Update Vaultwarden deliberately instead of tracking latest

Before an update:

  1. Read the Vaultwarden release notes and open compatibility issues.
  2. Run the built-in database backup and create a full off-server archive.
  3. Confirm a restore has been tested.
  4. Note the exact current image tag.

Check the currently running version:

Bash
cd /opt/vaultwarden sudo docker compose exec vaultwarden /vaultwarden --version

When you decide to move from 1.37.2 to a reviewed newer stable version, change the image: tag in compose.yaml, then run:

Bash
sudo docker compose pull vaultwarden sudo docker compose up -d vaultwarden

Verify the new version and logs:

Bash
sudo docker compose exec vaultwarden /vaultwarden --version sudo docker compose logs --tail=200 vaultwarden

Then test:

  • web-vault login;
  • browser extension login/sync;
  • one mobile/desktop client if you use it;
  • item creation/edit/sync;
  • WebSocket/live notifications;
  • attachments and 2FA methods relevant to your users.

If the new version fails and upstream permits rollback across that migration boundary, restore the previous pinned image and use the pre-update backup when required. Do not assume every database migration is safely reversible by changing only the Docker tag.

Verify: The updated server should report the intended exact version and all clients/workflows you rely on should pass before the update is considered complete.

Step 14 — Run the final security, exposure, and recovery audit

Inspect containers and host ports:

Bash
cd /opt/vaultwarden sudo docker compose ps sudo docker ps --format 'table {{.Names}}\t{{.Ports}}' sudo ss -tulpn

Review UFW if used:

Bash
sudo ufw status numbered

Verify application settings:

Bash
sudo docker compose exec vaultwarden printenv DOMAIN sudo docker compose exec vaultwarden printenv SIGNUPS_ALLOWED sudo docker compose exec vaultwarden /vaultwarden --version

Check HTTPS:

Bash
DOMAIN=$(sed -n 's/^DOMAIN=//p' .env) curl -I "https://$DOMAIN"

Confirm all of the following:

  • Vaultwarden is the reviewed stable version you intended to run;
  • only Caddy publishes public 80/443;
  • no 3012 WebSocket port exists;
  • HTTPS works with a trusted certificate;
  • public registration is disabled;
  • /admin is disabled unless intentionally required and protected with an Argon2 token;
  • SHOW_PASSWORD_HINT remains false for a public deployment;
  • the server's database is not exposed as a public service;
  • a recent full backup exists off-server;
  • the restore process has been tested;
  • client sync works from at least one real Bitwarden-compatible client;
  • VM disk usage, Docker image growth, and backup retention are monitored.

Expected architecture:

Text
Internet | | 80/443 v Caddy | | private Docker network v Vaultwarden 1.37.2 :80 | +--> /data (SQLite + attachments + keys + persistent state)

Verify: There should be no unintended public application port, no anonymous signup path, no plaintext admin token warning, no missing off-server backup, and no unresolved client-sync failure.

Troubleshooting

New Bitwarden clients cannot log in or sync

Check the server version first:

Bash
sudo docker compose exec vaultwarden /vaultwarden --version

Vaultwarden 1.37.2 is required by upstream for Bitwarden clients 2026.8.0 and newer. Update to a compatible reviewed stable release before debugging client behavior on an older server.

WebSocket/live sync is broken

Do not add port 3012. Modern Vaultwarden handles WebSockets on the normal HTTP port.

Check Caddy and Vaultwarden logs:

Bash
sudo docker compose logs --tail=200 caddy sudo docker compose logs --tail=200 vaultwarden

Ensure the reverse proxy points to vaultwarden:80 and supports normal WebSocket upgrades. Caddy's reverse_proxy does this automatically.

/admin accepts no token or reports an insecure plaintext token

The admin setting is named ADMIN_TOKEN. Generate an Argon2 hash using:

Bash
sudo docker run --rm -it vaultwarden/server:1.37.2 /vaultwarden hash

Then follow Vaultwarden's current admin-page documentation for the correct quoting/escaping in your configuration method. If data/config.json exists, remember that GUI-saved settings can override environment variables.

Backup exists but restored attachments are missing

A database backup contains database state, not every file under /data. Restore the matching attachments and other persistent directories from the full backup archive as well as the SQLite snapshot.

HTTPS certificate issuance fails

Check DNS, ports, and Caddy logs:

Bash
DOMAIN=$(sed -n 's/^DOMAIN=//p' /opt/vaultwarden/.env) dig +short A "$DOMAIN" dig +short AAAA "$DOMAIN" sudo ss -lntp | grep -E ':(80|443)\b' || true sudo docker compose logs --tail=200 caddy

An incorrect AAAA record can break IPv6 clients even when IPv4 works.

Compose changes do not affect Vaultwarden settings

Check logs for a message that settings are being overridden by /data/config.json. Values saved through the admin UI can take precedence over environment variables. Choose one configuration source deliberately instead of editing both independently.

Conclusion

You now have Vaultwarden running on Ubuntu 24.04 with Docker Compose, a pinned Vaultwarden 1.37.2 image, Caddy HTTPS, modern same-port WebSockets, public registration disabled after onboarding, the admin page disabled by default, and a backup/restore workflow that preserves both SQLite data and non-database files.

The important security boundary is broader than the Docker container itself. A usable self-hosted password manager depends on TLS, client/server version compatibility, controlled account creation, protected recovery configuration, consistent backups, and proven restores. Treat every Vaultwarden upgrade as a reviewed change rather than silently following a mutable latest tag.

For a broader operating-system security baseline, continue with Harden Ubuntu 24.04.

Deploy a Raff Ubuntu VM for a self-managed Vaultwarden and Caddy stack. Keep off-server backups and verify restores before adding real credentials.

Was this article helpful?
Aybars Altınyay
Aybars Altınyay
Platform Engineer & Technical Writer

Aybars is a Platform Engineer & Technical Writer at Raff Technologies. He works on Linux VM templates, self-hosted application workflows, and security-focused deployment validation, turning tested infrastructure procedures into clear, practical tutorials for developers and teams.

Put it into practice

Spin up a Raff server, follow the steps above on real infrastructure, and you are live. Linux or Windows, backed by a 14-day money-back guarantee.

Frequently asked questions

What is the current stable Vaultwarden version in this guide?
This revision pins Vaultwarden 1.37.2, released August 22, 2026. Upstream states that 1.37.2 is required for compatibility with Bitwarden clients version 2026.8.0 and newer.
Do I still need port 3012 or WEBSOCKET_ENABLED for Vaultwarden?
No. Modern Vaultwarden integrates WebSocket notifications into the normal HTTP server. A current reverse proxy should proxy the normal Vaultwarden HTTP port and support WebSocket upgrades; the legacy dedicated 3012 path is retired/deprecated.
Should I use vaultwarden/server:latest in Docker Compose?
For a security-critical service, an exact reviewed stable tag is easier to audit and roll through deliberately. This guide pins 1.37.2 and recommends reviewing release notes, backing up, and explicitly changing the tag for future updates.
How should I secure the Vaultwarden admin token?
Keep the admin page disabled unless you need it. If enabled, generate an Argon2 PHC hash with `/vaultwarden hash` and use it as `ADMIN_TOKEN`. Follow the official admin-page documentation for quoting or escaping because `$` handling varies by Compose/env/stack-manager configuration.
Why can Vaultwarden environment variables appear to be ignored?
Settings saved through the Vaultwarden admin UI are stored in `/data/config.json` and can override environment variables on later starts. Avoid managing the same setting independently in both Compose and the admin GUI.
What should a Vaultwarden backup include?
Use Vaultwarden's built-in backup command for a consistent SQLite snapshot and also preserve the rest of `/data`, including attachments, Send data, keys, and configuration. Keep at least one protected copy off-server and test a restore.
Can I back up Vaultwarden by copying db.sqlite3 while it is running?
A raw copy of an actively written SQLite database can miss WAL state. This guide uses Vaultwarden's built-in backup command to create a consistent `db_*.sqlite3` snapshot, then archives the remaining persistent data from a quiet state.
Is HTTPS required for a public Vaultwarden server?
Yes. Password-manager clients and browser cryptographic features expect a secure context. This guide places Vaultwarden behind Caddy so only ports 80/443 are public and the application container remains on a private Docker network.