Docker

The published image, docker run, Compose for both database modes, configuration, HTTPS, backups and upgrades.

Forkbase publishes a container image for each release: ghcr.io/2090-labs/forkbase. It holds forkbase, the Chronos engine and Node 22, for linux/amd64 and linux/arm64. This page runs it with docker run and with Docker Compose, in both database modes, and covers configuration, keys, logs, upgrades, backups and removal.

What the machine needs: Requirements. Docker Engine 20.10+ with Compose v2, Docker Desktop (macOS, Windows) or OrbStack.

The image

Nameghcr.io/2090-labs/forkbase
Tagsthe version, such as 0.9.1, and latest. Pin the version in anything you keep
Platformslinux/amd64, linux/arm64
Holdsforkbase, chronos (the engine the release was tested with), Node 22 for TypeScript and JavaScript jobs
Usernon-root, uid 65532
Data/data, a volume: the engine's database, secrets, keys, stored files
Port8000 (the API and dashboard). In chronos mode also the engine's SQL port when you set FORKBASE_CHRONOS_PG_LISTEN
BaseGoogle's distroless Node 22 image: no shell, no package manager
Built fromthe release's signed tarballs, each checked against its SHA256SUMS (deploy/Dockerfile.release)
shell
docker pull ghcr.io/2090-labs/forkbase:0.9.1

Quick start: one container

On the engine, nothing else to run:

shell
docker run -d --name forkbase --restart unless-stopped \
  -p 127.0.0.1:8000:8000 \
  -e FORKBASE_DB=chronos \
  -v forkbase-data:/data \
  ghcr.io/2090-labs/forkbase:0.9.1

Then:

shell
docker exec forkbase forkbase status          # {"status": "ok", ...} once it's up
docker exec forkbase forkbase keys            # the anon and service_role keys
printf '%s\n' "$PASSWORD" | docker exec -i forkbase forkbase owner --email you@company.com

Open http://127.0.0.1:8000/dashboard/ and sign in with that email and password.

FORKBASE_DB=chronos matters: the default mode is postgres, which needs a database URL. The port is published on the host's 127.0.0.1 only, so nothing outside the machine reaches it until you put a TLS proxy in front.

Docker Compose

Save one of these as compose.yml, beside an .env file, and run docker compose up -d.

On the engine (chronos mode)

YAML
services:
  forkbase:
    image: ghcr.io/2090-labs/forkbase:0.9.1
    restart: unless-stopped
    environment:
      FORKBASE_DB: chronos
      FORKBASE_EXTERNAL_URL: ${FORKBASE_EXTERNAL_URL:-http://127.0.0.1:8000}
      FORKBASE_CHRONOS_PG_LISTEN: 0.0.0.0:54329     # only if apps need SQL; else leave it out
    volumes:
      - forkbase-data:/data
    ports:
      - "127.0.0.1:8000:8000"
      - "127.0.0.1:54329:54329"                     # only with FORKBASE_CHRONOS_PG_LISTEN
    healthcheck:
      test: ["CMD", "/usr/local/bin/forkbase", "status"]
      interval: 10s
      timeout: 5s
      retries: 30
      start_period: 30s

volumes:
  forkbase-data:
    name: forkbase-data   # a fixed name, so the backup commands below find it

Over Postgres (postgres mode)

A Postgres 16 beside it. To use a Postgres you already run, drop the postgres service and set FORKBASE_DATABASE_URL to yours.

YAML
services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_USER: forkbase
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
      POSTGRES_DB: app
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U forkbase -d app"]
      interval: 2s
      timeout: 3s
      retries: 30

  forkbase:
    image: ghcr.io/2090-labs/forkbase:0.9.1
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      FORKBASE_DB: postgres
      FORKBASE_DATABASE_URL: postgres://forkbase:${POSTGRES_PASSWORD}@postgres:5432/app?sslmode=disable
      FORKBASE_EXTERNAL_URL: ${FORKBASE_EXTERNAL_URL:-http://127.0.0.1:8000}
    volumes:
      - forkbase-data:/data
    ports:
      - "127.0.0.1:8000:8000"
    healthcheck:
      test: ["CMD", "/usr/local/bin/forkbase", "status"]
      interval: 10s
      timeout: 5s
      retries: 30
      start_period: 30s

volumes:
  pgdata:
    name: forkbase-pgdata
  forkbase-data:
    name: forkbase-data   # a fixed name, so the backup commands below find it
shell
# .env
POSTGRES_PASSWORD=<openssl rand -hex 16>
FORKBASE_EXTERNAL_URL=https://api.myapp.com

Postgres is not published on the host: only Forkbase reaches it, over Compose's network. Agents in postgres mode use the engine inside the same container; nothing more to run.

Then

shell
docker compose ps                                   # forkbase: healthy
docker compose exec forkbase forkbase keys
printf '%s\n' "$PASSWORD" | docker compose exec -T forkbase forkbase owner --email you@company.com
docker compose logs -f forkbase

Configure it

Every setting in Configuration has a FORKBASE_* variable, and a variable always wins over forkbase.toml, so a container needs no file. The ones you'll set first:

VariableSet it to
FORKBASE_DBchronos or postgres
FORKBASE_DATABASE_URLpostgres mode: the database (or FORKBASE_DATABASE_URL_FILE for a Docker secret)
FORKBASE_EXTERNAL_URLthe address people and apps reach, https://api.myapp.com. Tokens name it; emailed links and OAuth point at it
FORKBASE_SITE_URL and the email settingsyour app's address and SMTP, for sign-up and password emails (see Auth)
FORKBASE_LOGinfo (default) or debug

The image already sets FORKBASE_DATA=/data, FORKBASE_LISTEN=0.0.0.0:8000, the engine's path and Node's path: leave those.

For a full file instead (merge policies, many settings), mount it and the policies folder:

YAML
    volumes:
      - forkbase-data:/data
      - ./forkbase.toml:/etc/forkbase/forkbase.toml:ro
      - ./policies:/etc/forkbase/policies:ro
    environment:
      FORKBASE_CONFIG: /etc/forkbase/forkbase.toml

Keep secrets (database password, SMTP password, OAuth secrets, S3 keys) in variables, not in the file. The database URL can also come from a Docker secret with FORKBASE_DATABASE_URL_FILE.

Behind HTTPS

The container serves plain HTTP. Put a TLS proxy in front, on the same host, and set FORKBASE_EXTERNAL_URL to the https:// address. Caddy gets the certificate itself:

text
api.myapp.com {
    reverse_proxy 127.0.0.1:8000
}

Realtime WebSockets pass through. With nginx, forward the Upgrade and Connection headers and set X-Forwarded-For. More in Self-hosting.

Reach the database with SQL

postgres mode: connect to your Postgres as usual (docker compose exec postgres psql -U forkbase app).

chronos mode: publish the engine's port (FORKBASE_CHRONOS_PG_LISTEN: 0.0.0.0:54329 and 127.0.0.1:54329:54329), then connect as app with the engine token from /data/secrets.json. The image has no shell, so read the file with a throwaway container:

shell
docker run --rm -v forkbase-data:/data busybox cat /data/secrets.json     # engine_token
psql "postgres://app:<engine_token>@127.0.0.1:54329/main?sslmode=require"

The dashboard's SQL page needs none of this.

Jobs

TypeScript and JavaScript jobs run in the container with its Node 22. Python jobs need python3, which the image doesn't have: build your own image on top of it with Python added, or run Forkbase with the install script on a machine that has Python. Give the container memory for its busiest minute of jobs.

Limits

Forkbase is small at rest (tens of MB, see Requirements); give it room for agent runs and jobs:

YAML
    deploy:
      resources:
        limits:
          memory: 2g
          cpus: "2"

Upgrade

Change the tag, then pull and recreate. The volume keeps your data; migrations run at start and never drop data.

shell
# compose.yml: ghcr.io/2090-labs/forkbase:0.9.1 -> the new version
docker compose pull && docker compose up -d
docker compose exec forkbase forkbase status

Read the changelog first, and back up before an upgrade: going back to an older version means restoring that backup. With several Forkbase containers on one Postgres, run docker compose run --rm forkbase migrate once before starting the new ones.

Back up

What to keep is the forkbase-data volume (and, in postgres mode, your Postgres). The Compose files above give it that fixed name; without name:, Compose calls it <project>_forkbase-data (see docker volume ls), and the commands below must use that name instead.

  • While it runs (chronos mode): the dashboard's Database, Backups, or POST /platform/v1/backups, copies the engine's database into /data/backups/<time>. Copy it off the host.
  • The whole volume, with Forkbase stopped:
    shell
    docker compose stop forkbase
    docker run --rm -v forkbase-data:/data -v "$PWD":/backup busybox tar -czf /backup/forkbase-data.tgz -C /data .
    docker compose start forkbase
  • postgres mode: docker compose exec postgres pg_dump -U forkbase -Fc app > app.dump, plus the volume (its secrets.json signs your API keys and sessions: without it, every key and session stops working).

To restore the volume: stop Forkbase, then docker run --rm -v forkbase-data:/data -v "$PWD":/backup busybox sh -c 'rm -rf /data/* && tar -xzf /backup/forkbase-data.tgz -C /data', and start it.

Stop and remove

shell
docker compose stop          # stop, keep everything
docker compose down          # remove the containers, keep the volumes (your data)
docker compose down -v       # also delete the volumes: the database, files and keys, for good

With docker run: docker stop forkbase, docker rm forkbase, and docker volume rm forkbase-data only when you mean to delete the data.

Build the image yourself

From a release's tarballs (a minute, both platforms):

shell
git clone --branch v0.9.1 https://github.com/2090-labs/forkbase && cd forkbase
docker buildx build -f deploy/Dockerfile.release --platform linux/amd64,linux/arm64 \
  --build-arg VERSION=0.9.1 --build-arg ENGINE_VERSION=0.9.3 -t forkbase:0.9.1 .

Or compile it: docker build -f deploy/Dockerfile -t forkbase . (wants 8 GB of memory). The repository's deploy/docker-compose.chronos.yml and deploy/docker-compose.postgres.yml build this way.

When something goes wrong

You seeDo this
postgres mode needs the database's URLset FORKBASE_DB=chronos, or FORKBASE_DATABASE_URL
permission denied under /dataa bind mount owned by root: sudo chown -R 65532:65532 ./data, or use a named volume
docker exec ... sh: no such filethe image has no shell. Use forkbase commands, or a busybox container on the volume
no matching manifest for linux/arm/v732-bit ARM isn't built. Use a 64-bit OS
exec format errorthe image doesn't match the host's CPU: pull without --platform, or pick linux/arm64 / linux/amd64
the dashboard's links or emails point at 127.0.0.1set FORKBASE_EXTERNAL_URL
unhealthy, database not okpostgres mode: check the URL and that Postgres is healthy. docker compose logs forkbase
Python jobs fail with python3 not foundsee Jobs

More in Troubleshooting.

Something wrong or missing? Edit this page on GitHub or open an issue.

Docker · Forkbase