Docker Compose
Use Docker Compose when running directly on a Linux server or VPS. On Dokploy or Coolify, follow their pages instead—those panels manage their own edge proxy and must not publish host ports directly.
Prerequisites
Section titled “Prerequisites”- Docker Engine with the Compose plugin (
docker compose). - For HTTPS with Caddy: a domain whose DNS
A/AAAArecord points at the server, with ports80and443open.
Plain Compose
Section titled “Plain Compose”Save as docker-compose.yml (matching Kova’s hardened example Compose file):
services: kova: image: ghcr.io/rushlightlab/kova:0.1.0 container_name: kova restart: unless-stopped read_only: true tmpfs: - /tmp cap_drop: - ALL security_opt: - no-new-privileges:true stop_grace_period: 15s ports: - "127.0.0.1:3000:3000" env_file: - .env volumes: - kova_data:/data logging: driver: json-file options: max-size: "10m" max-file: "3"
volumes: kova_data:Create .env next to it (chmod 600 .env and never commit it to Git). Generate KOVA_ENCRYPTION_KEY with openssl rand -hex 32:
KOVA_BASE_URL=http://localhost:3000# Encrypts saved S3 credentials (32 bytes): openssl rand -hex 32KOVA_ENCRYPTION_KEY=<generated-64-hex-key># Recommended on public hosts (skips unauthenticated /setup):KOVA_ADMIN_EMAIL=you@example.comKOVA_ADMIN_PASSWORD=<strong-12+-char-password># Uncomment if connecting to local/LAN MinIO, Garage, or RustFS:# KOVA_ALLOW_PRIVATE_ENDPOINTS=trueStart Kova:
docker compose up -dHTTPS with Caddy
Section titled “HTTPS with Caddy”The repository’s deploy/ folder ships a ready-made TLS stack: deploy/docker-compose.tls.yml runs Kova and Caddy on an isolated 172.30.0.0/24 bridge network so only ports 80 and 443 are exposed publicly and KOVA_TRUSTED_PROXIES is pinned strictly to Caddy (172.30.0.10/32).
services: kova: image: ghcr.io/rushlightlab/kova:0.1.0 restart: unless-stopped read_only: true tmpfs: - /tmp cap_drop: - ALL security_opt: - no-new-privileges:true stop_grace_period: 15s expose: - "3000" env_file: - path: .env required: false environment: KOVA_BASE_URL: ${KOVA_BASE_URL:?set KOVA_BASE_URL=https://your.domain} KOVA_ENCRYPTION_KEY: ${KOVA_ENCRYPTION_KEY:?set KOVA_ENCRYPTION_KEY=$(openssl rand -hex 32)} KOVA_TRUSTED_PROXIES: 172.30.0.10/32 volumes: - kova_data:/data networks: - kova
caddy: image: caddy:2-alpine depends_on: - kova environment: KOVA_DOMAIN: ${KOVA_DOMAIN:-kova.example.com} ports: - "80:80" - "443:443" - "443:443/udp" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config networks: kova: ipv4_address: 172.30.0.10 restart: unless-stopped security_opt: - no-new-privileges:true
volumes: kova_data: caddy_data: caddy_config:
networks: kova: ipam: config: - subnet: 172.30.0.0/24Create Caddyfile alongside docker-compose.tls.yml:
{$KOVA_DOMAIN:kova.example.com} { encode zstd gzip
header { Strict-Transport-Security "max-age=31536000; includeSubDomains" X-Content-Type-Options "nosniff" Referrer-Policy "no-referrer" -Server }
reverse_proxy kova:3000}Create .env in the same directory:
KOVA_DOMAIN=kova.example.comKOVA_BASE_URL=https://kova.example.com# Encrypts saved S3 credentials (32 bytes): openssl rand -hex 32KOVA_ENCRYPTION_KEY=<generated-64-hex-key>KOVA_ADMIN_EMAIL=you@example.comKOVA_ADMIN_PASSWORD=<strong-12+-char-password>Start both services:
docker compose -f docker-compose.tls.yml up -dEnvironment variables
Section titled “Environment variables”| Variable | Notes |
|---|---|
KOVA_BASE_URL |
Exact public origin in your browser. Required by docker-compose.tls.yml. |
KOVA_ENCRYPTION_KEY |
32-byte hex or base64 key (openssl rand -hex 32). Keep a backup outside /data. |
KOVA_DOMAIN |
TLS stack only: hostname Caddy serves and requests a Let’s Encrypt cert for. |
KOVA_ADMIN_EMAIL / KOVA_ADMIN_PASSWORD |
Headless Admin bootstrap when zero users exist (recommended on public servers). |
KOVA_TRUSTED_PROXIES |
Pinned to 172.30.0.10/32 in the TLS stack; leave unset without a reverse proxy. |
See Environment Variables for OIDC/SSO, libSQL/Turso, and upload settings.
Upgrade
Section titled “Upgrade”Back up /data/kova.db, bump the image tag in your Compose file, and recreate:
docker compose pull && docker compose up -d# TLS stack:docker compose -f docker-compose.tls.yml pull && docker compose -f docker-compose.tls.yml up -dTroubleshooting
Section titled “Troubleshooting”- Sign-in returns
403 INVALID_ORIGIN:KOVA_BASE_URLdoes not match the browser origin. Fix.envand rundocker compose up -dagain. Pool overlaps with other one on this address space: Another Docker network already uses172.30.0.0/24. Pick an unused/24subnet indocker-compose.tls.ymland update bothipv4_addressandKOVA_TRUSTED_PROXIESto match.- Caddy cannot obtain a certificate: Verify DNS points to the host and ports
80and443are reachable, then checkdocker compose -f docker-compose.tls.yml logs caddy.