composebuilder

Docker Compose: Vaultwarden Self-Hosted Password Manager

Self-host Vaultwarden 1.37 password manager in Docker Compose. Pinned image, HTTPS domain setup, hashed admin token, sign-up control and backup checklist.

When to use this stack

Vaultwarden is a lightweight, unofficial server implementation of the Bitwarden API written in Rust. It lets you run your own password manager and keep the encrypted vault on a machine you control, while using the official Bitwarden clients for browsers, desktop and mobile. This stack pins the vaultwarden/server 1.37.5 image, stores the SQLite database and attachments in one named volume, and binds the service to 127.0.0.1 so that you can add a reverse proxy with TLS. Sign-ups are controlled by a variable, so you can create your own account first and then close registration.

Use this stack when you want to manage your own family or small-team passwords, and you can keep the server patched and backed up. Do not use it when you cannot provide HTTPS with a valid certificate, because the clients will refuse to work correctly and credentials would travel unprotected. Do not use it as your only copy of critical passwords, since a server failure without a tested backup means lost access. Also avoid it if no one in your household or team can take responsibility for updates, because a password manager that is not patched is a weak point rather than a safe place.

docker-compose.yml

services:
  vaultwarden:
    image: vaultwarden/server:1.37.5
    restart: unless-stopped
    environment:
      DOMAIN: ${DOMAIN}
      ADMIN_TOKEN: ${ADMIN_TOKEN}
      SIGNUPS_ALLOWED: ${SIGNUPS_ALLOWED}
      TZ: ${TZ}
    ports:
      - "127.0.0.1:8081:80"
    volumes:
      - vw_data:/data

volumes:
  vw_data:

.env

.env
DOMAIN=https://vault.example.com
ADMIN_TOKEN=CHANGE_ME_ADMIN_TOKEN_OR_ARGON2_HASH_WITH_DOUBLED_DOLLARS
SIGNUPS_ALLOWED=true
TZ=Europe/Madrid

Set SIGNUPS_ALLOWED to false after you have created your own account. If you store an Argon2 hash in ADMIN_TOKEN, double every dollar sign in the value, because Docker Compose treats a single dollar sign as the start of a variable name.

Start and verify

Shell
# 1. Validate the compose file and the variable substitution
docker compose config --quiet

# 2. Start Vaultwarden in the background
docker compose up -d

# 3. The container should show "Up"
docker compose ps

# 4. Check the alive endpoint through the loopback port (expected: a timestamp in JSON)
curl -fsS http://127.0.0.1:8081/alive

# 5. Follow the log for warnings about the domain or the admin token
docker compose logs --tail=50 vaultwarden

Once the reverse proxy serves https://vault.example.com, open the web vault, create your account, then set SIGNUPS_ALLOWED=false in .env and run docker compose up -d. Log in to the admin page at /admin with the token to check the settings and the diagnostics page.

Production checklist

  • Serve Vaultwarden only over HTTPS through a reverse proxy, and keep the loopback binding so the container is not reachable directly.
  • Set SIGNUPS_ALLOWED to false after your accounts exist, and invite new users from the admin page when needed.
  • Enable two-factor authentication for every account, starting with the administrator.
  • Back up the vw_data volume every day, and test a restore on a second machine, because the encrypted vault is useless without a working copy.
  • Store the ADMIN_TOKEN hash only in .env on the server and keep the plain token in your own password manager.
  • Turn off the admin page entirely when you do not need it, by removing ADMIN_TOKEN or blocking /admin at the reverse proxy.
  • Pin the image tag and update regularly, because security fixes are released often for a server that handles credentials.
  • Restrict SSH access to the host and use key-based login only.

Common problems

  • Symptom: the Bitwarden browser extension or app refuses to connect to the server. Cause: the address is plain HTTP, or the certificate is not trusted by the device. Fix: serve the domain over HTTPS with a valid certificate and enter the exact DOMAIN value in the client’s self-hosted server field.
  • Symptom: the admin page says the token is invalid. Cause: the hash was copied without doubling the dollar signs, so Compose changed it before the container saw it. Fix: double every dollar sign in .env and restart the container.
  • Symptom: links in the emails or the web vault point to the wrong address. Cause: DOMAIN does not match the public address. Fix: set DOMAIN to the full address with https and restart the container.
  • Symptom: new users cannot register even though you set SIGNUPS_ALLOWED to true. Cause: the container was not recreated after the change, or an invitation is required. Fix: run docker compose up -d to apply the new environment and check the admin settings for invitation rules.
  • Symptom: after a restore, some accounts cannot log in. Cause: the restored volume came from an older snapshot taken while the database was being written. Fix: stop the container before copying the volume, or use the SQLite backup method described in the Vaultwarden wiki.

Variations

  • Caddy for HTTPS: add a Caddy service on the same network that proxies vault.example.com to vaultwarden:80. Caddy obtains the certificate automatically, and you remove the loopback port mapping if Caddy is the only entry point.
  • PostgreSQL or MySQL backend: Vaultwarden can use an external database through its DATABASE_URL setting. Use this when you already run a managed database and want its backup tools, and follow the official documentation for the connection string format.
  • Private network only: bind the port to a WireGuard or Tailscale address instead of 127.0.0.1, so the vault is reachable only from your own devices. This avoids public exposure while keeping clients working, provided the clients trust the certificate you use.

Questions

Is Vaultwarden compatible with the Bitwarden apps?

Yes. Vaultwarden implements the Bitwarden server API, so the official Bitwarden browser extensions, desktop apps and mobile apps work with it when you point them to your server address.

Why does Vaultwarden need HTTPS?

Bitwarden clients require a secure context for most features, and sending a master password over plain HTTP exposes it to anyone on the network. Use HTTPS for the DOMAIN value, except when you test on localhost.

What is the ADMIN_TOKEN for?

It protects the administration page at /admin, where you can invite users, change settings and view diagnostics. Store it as an Argon2 hash rather than as plain text, and keep it separate from your vault passwords.

Adapt this stack

Load these files into the builder to rename services, change ports, add a cache or a proxy, and generate fresh passwords for the .env.

Open in builder
  • Home Assistant Smart Home Hub

    Run Home Assistant 2026.10 in Docker Compose with a pinned image, persistent config volume, timezone setup and reverse proxy notes for secure remote access.

    • homeassistant
    Difficulty: Intermediate
  • n8n Workflow Automation with PostgreSQL

    Self-host n8n 2.48 with PostgreSQL 16 in Docker Compose: encrypted credentials, database healthcheck, loopback-only port and a production checklist.

    • postgres
    • n8n
    Difficulty: Intermediate
  • Nextcloud + MariaDB + Redis File Sync

    Self-host Nextcloud with MariaDB 11.4 and Redis in Docker Compose. Pinned tags, database healthcheck, memory cache and the production steps for HTTPS and cron.

    • nextcloud
    • db
    • redis
    Difficulty: Intermediate
  • Ollama + Open WebUI Local AI Chat

    Run local AI models with Ollama and a chat interface with Open WebUI in Docker Compose. Pinned images, a health check, loopback-only access and RAM guidance.

    • ollama
    • open-webui
    Difficulty: Beginner

Browse more Automation, AI & Self-Hosted stacks or the full library.