Skip to content

Docker and Compose

The root Dockerfile is multi-stage:

  1. Build stage. Checks Node is 22.19 or newer, runs npm ci, then npm run build (the dashboard and the server), then npm prune --omit=dev.
  2. Run stage. node:22-slim, runs as the non-root node user, exposes port 3000, has a health check, and starts node --no-warnings apps/server/dist/server.mjs.

Workspace packages stay TypeScript. Node strips the types at run time. They must be production dependencies of the server so pruning keeps them in the image.

Terminal window
docker build -t knetik .

The docs site (apps/docs) is not part of the image.

deploy/docker-compose.yml runs Knetik on one machine, with its data folder on a volume.

Terminal window
cd deploy
cp .env.example .env # fill it in
docker compose up -d --build

Open KNETIK_BASE_URL. Compose requires KNETIK_BASE_URL. The Knetik service reads the sign-in, connector and model variables from the same .env.

The data folder (KNETIK_DATA_DIR: knetik.db, flue.db and artifacts/) lives on a volume. docker compose down keeps it. docker compose down --volumes removes it along with all data, so use that only to start over.

deploy/.env
KNETIK_BASE_URL=http://localhost:3000
KNETIK_ALLOWED_USERS=you@example.com
KNETIK_ADMINS=you@example.com
KNETIK_MAIL=console

KNETIK_MAIL=console prints sign-in links to the server log: fine for a trial, not for production. See Sign-in.

Put a TLS-terminating proxy (Caddy, nginx, or a cloud load balancer) in front, set KNETIK_BASE_URL=https://... and KNETIK_TRUST_PROXY=1. See the overview for the one-instance rule.

Terminal window
docker compose ps
curl http://localhost:3000/api/health

Sign in, start a run, restart the container (docker compose restart knetik), and confirm the run and its gate are still there. The container test does exactly this.

Everything Knetik stores on Node is in the data folder: runs, events, gate decisions, sessions and connections (encrypted) in knetik.db, the agent framework’s store in flue.db, and artifact files. Back up the whole folder (stop the server first, or use SQLite’s own backup tooling for a consistent copy) and, if you use connectors, KNETIK_SECRET_KEY. Without the key, stored connections cannot be decrypted.