Skip to content

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.

  • Docker Engine with the Compose plugin (docker compose).
  • For HTTPS with Caddy: a domain whose DNS A/AAAA record points at the server, with ports 80 and 443 open.

Save as docker-compose.yml (matching Kova’s hardened example Compose file):

docker-compose.yml
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:

.env
KOVA_BASE_URL=http://localhost:3000
# Encrypts saved S3 credentials (32 bytes): openssl rand -hex 32
KOVA_ENCRYPTION_KEY=<generated-64-hex-key>
# Recommended on public hosts (skips unauthenticated /setup):
KOVA_ADMIN_EMAIL=you@example.com
KOVA_ADMIN_PASSWORD=<strong-12+-char-password>
# Uncomment if connecting to local/LAN MinIO, Garage, or RustFS:
# KOVA_ALLOW_PRIVATE_ENDPOINTS=true

Start Kova:

Terminal window
docker compose up -d

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).

docker-compose.tls.yml
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/24

Create Caddyfile alongside docker-compose.tls.yml:

Caddyfile
{$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:

.env
KOVA_DOMAIN=kova.example.com
KOVA_BASE_URL=https://kova.example.com
# Encrypts saved S3 credentials (32 bytes): openssl rand -hex 32
KOVA_ENCRYPTION_KEY=<generated-64-hex-key>
KOVA_ADMIN_EMAIL=you@example.com
KOVA_ADMIN_PASSWORD=<strong-12+-char-password>

Start both services:

Terminal window
docker compose -f docker-compose.tls.yml up -d
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.

Back up /data/kova.db, bump the image tag in your Compose file, and recreate:

Terminal window
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 -d
  • Sign-in returns 403 INVALID_ORIGIN: KOVA_BASE_URL does not match the browser origin. Fix .env and run docker compose up -d again.
  • Pool overlaps with other one on this address space: Another Docker network already uses 172.30.0.0/24. Pick an unused /24 subnet in docker-compose.tls.yml and update both ipv4_address and KOVA_TRUSTED_PROXIES to match.
  • Caddy cannot obtain a certificate: Verify DNS points to the host and ports 80 and 443 are reachable, then check docker compose -f docker-compose.tls.yml logs caddy.