Docker Compose
Use this when Docker runs directly on the server. On Dokploy or Coolify, follow their pages instead: those platforms route through their own proxy and must not publish a host port.
Prerequisites
Section titled “Prerequisites”- Docker Engine with the Compose plugin (
docker compose). - For HTTPS: a domain whose DNS points at the server, and ports 80 and 443 open.
Plain Compose
Section titled “Plain Compose”Create docker-compose.yml:
services: kinglet: image: ghcr.io/rushlightlab/kinglet:0.5.0 restart: unless-stopped ports: - "127.0.0.1:8080:3000" env_file: .env volumes: - kinglet-data:/data security_opt: - no-new-privileges:true cap_drop: - ALL
volumes: kinglet-data:Create .env next to it (mode 600, out of Git):
KINGLET_BASE_URL=http://localhost:8080KINGLET_ADMIN_EMAIL=you@example.comKINGLET_ADMIN_PASSWORD=<strong-password># Encrypts notification channel secrets: openssl rand -base64 32KINGLET_SECRET_KEY=<generated key>Start it:
docker compose up -dIf you left the admin password unset, read the generated one with
docker compose exec kinglet cat /data/admin-password.txt.
The port is bound to loopback. To serve the public, put a TLS proxy in front, or
use the Caddy sample below. The container runs as UID 1000 (node), so if you
replace the named volume with a host bind mount, make sure that directory is
writable by UID 1000.
HTTPS with Caddy
Section titled “HTTPS with Caddy”The repository’s deploy/
folder has a ready-made stack: docker-compose.tls.yml runs Kinglet and Caddy,
and Caddyfile configures Caddy. Caddy obtains and renews certificates, sets
HSTS, and is the only container that publishes ports (80 and 443). Kinglet is
reachable only over the Compose network.
-
Copy
deploy/docker-compose.tls.ymlanddeploy/Caddyfileinto one directory on the server. -
Point your domain’s DNS at the server.
-
Create
.envin that directory:.env KINGLET_DOMAIN=logs.example.comKINGLET_BASE_URL=https://logs.example.comKINGLET_ADMIN_EMAIL=you@example.comKINGLET_ADMIN_PASSWORD=<strong-password> -
Start the stack:
Terminal window docker compose -f docker-compose.tls.yml up -d -
Open
https://logs.example.com.
The sample gives Caddy the fixed address 172.30.0.10 on a dedicated
172.30.0.0/24 network and sets KINGLET_TRUSTED_PROXIES=172.30.0.10/32, so
proxy trust is already narrow. If you change the subnet, change the Caddy
address and KINGLET_TRUSTED_PROXIES with it.
Environment variables
Section titled “Environment variables”| Variable | Notes |
|---|---|
KINGLET_BASE_URL |
Exact public origin. The TLS sample refuses to start without it. |
KINGLET_DOMAIN |
TLS sample only: the hostname Caddy serves and requests a certificate for. |
KINGLET_ADMIN_EMAIL / KINGLET_ADMIN_PASSWORD |
Used only while no administrator exists. |
BETTER_AUTH_SECRET |
Optional on one instance; generated in /data otherwise. |
KINGLET_SECRET_KEY |
Encrypts channel secrets; needed to add notification channels. |
KINGLET_TRUSTED_PROXIES |
Empty without a proxy; the proxy’s /32 with one. Set already in the TLS sample. |
See the configuration reference for retention, caps, search, and S3 backups.
Upgrade
Section titled “Upgrade”Back up /data, change the image tag in the compose file, then:
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 -dMigrations run on boot; read the upgrade notes first.
Troubleshooting
Section titled “Troubleshooting”- Sign-in returns
403 INVALID_ORIGIN.KINGLET_BASE_URLdoes not match the browser origin. Fix.envand rundocker compose up -dagain. - Caddy has no certificate. DNS does not point at the server yet, or ports
80/443 are blocked. Check
docker compose -f docker-compose.tls.yml logs caddy. Pool overlaps with other one on this address space. Another Docker network already uses172.30.0.0/24. Pick a free subnet and update the Caddy address andKINGLET_TRUSTED_PROXIESto match.address already in use. Another service holds the host port (8080, or 80/443 for Caddy). Free it or map a different host port.