Skip to main content

Running the server stack in Docker

Status: Ready

Truth label: Current

Audience: Fleet operator

Reader outcome: Run Brain, Forge Central, and Cortex in containers with the data root mounted correctly, and cut workers over.

Last verified: 2026-09-13

daemon; see What has not been verified.

This covers Forge Central, Brain, and Cortex. Workers are not containerized and should not be. See the decisions record DEC-20260906-01 for why.

1. What you get​

ServicePortNotes
preflightnoneRuns once, exits. Central and Brain wait for it to succeed
central8080Forge. Holds the process lock on the data root
brain8081Brain. Writes chroma/
cortex3000Static files. No data volume, no content mounts
opsnoneBackup, restore, maintenance. Only under --profile ops

restart: unless-stopped replaces scripts/windows/supervisor.ps1. There is no Linux equivalent of that script, and with Docker there does not need to be.

2. The one rule that matters​

The data root is a named volume. Never a bind mount.

A bind mount from a Windows or macOS host reaches the container as virtiofs or 9p. SQLite documents WAL as unsupported there and its advisory locks do not interop across the boundary. shared/store.py refuses those filesystems, including from inside a container, and says so rather than corrupting the database quietly.

That guard used to be gated on WSL_DISTRO_NAME, which is unset in a container, so it was inert exactly where the mistake is easiest to make: /data looks native and nothing in the path spelling says otherwise. The gate is gone as of 2026-09-06 and the refused list now covers virtiofs, cifs, and nfs alongside 9p and drvfs.

Content directories are different from the SQLite data root and can be bind-mounted from the host. As of 2026-09-08, Brain's voice-pack and influence library mounts permit Cortex profile editing and reviewed source imports. Preflight, backup, and knowledge mounts remain read-only. Recreate an existing Brain container to apply changed mounts. See Cortex writing and the influence library.

3. Configure​

Compose reads the repo .env twice, for two different jobs.

As the container environment (env_file), which supplies AA_API_TOKEN, the provider keys, and every non-path setting. The environment: block then overrides all six path settings, because the values in .env are desktop paths and mean nothing inside a container:

DATA_DIR=/data INFLUENCE_LIBRARY_DIR=/content/influences
SE_MANAGER_DATA_DIR=/data VOICE_PACK_DIR=/content/voice
AA_BIND_HOST=0.0.0.0 KNOWLEDGE_DIR=/content/brain

As compose variables, for the host side of each bind mount. Add these to .env; they are read by compose and ignored by the application:

AA_HOST_INFLUENCES=/srv/agentasian/influences
AA_HOST_VOICE=/srv/agentasian/voice
AA_HOST_KNOWLEDGE=/srv/agentasian/brain
AA_HOST_BACKUPS=/srv/agentasian/backups

Then set two values that name the host and not the container:

AA_ALLOWED_ORIGINS=http://<host>:3000
OLLAMA_BASE_URL=http://192.168.0.13:11434

Your current OLLAMA_BASE_URL is already a LAN address, so it resolves from a container unchanged. If you move Ollama onto the Docker host itself, use http://host.docker.internal:11434 and add extra_hosts: ["host.docker.internal:host-gateway"] on Linux.

Leave EMBEDDING_PROVIDER and EMBEDDING_MODEL unset. Chroma pins each collection to the provider and model that wrote its vectors and rejects a mismatch, so changing either one strands the existing store.

Two path settings preflight enforces: each content directory must exist, contain at least one supported file, and must not sit inside DATA_DIR. Mounting them under /data is the obvious tidy layout and it is the one layout that fails.

4. Start​

docker compose build
docker compose up -d
docker compose logs -f preflight # names the setting when a content dir is wrong

Then:

curl -s http://<host>:8080/health
curl -s http://<host>:8081/health
curl -s http://<host>:8081/knowledge/collections

Open http://<host>:3000. Cortex needs no build and no API address: cortex-ui/src/api.js derives both from window.location.hostname. If it says "Failed to fetch", the cause is almost always AA_ALLOWED_ORIGINS still naming the old machine.

5. Move an existing data root in​

The volume starts empty. Fill it from a backup rather than by copying files.

On the desktop, with Central and Brain stopped:

.\.venv\Scripts\python.exe scripts\backup_data.py --encrypt --output C:\transfer

On the Docker host, with the archive in $AA_HOST_BACKUPS:

docker compose up -d preflight # creates the volume, verifies config
docker compose --profile ops run --rm -e AA_BACKUP_PASSPHRASE ops \
scripts/restore_data.py /export/agentasian-<stamp>.zip.enc --dry-run
docker compose --profile ops run --rm -e AA_BACKUP_PASSPHRASE ops \
scripts/restore_data.py /export/agentasian-<stamp>.zip.enc --yes
docker compose up -d

Export the passphrase rather than typing it. restore_data.py resolves it twice, once to verify the manifest and once to read the archive, with no caching between them.

Copy the three content directories to the host separately. No archive contains them.

6. Backup and restore, once containerized​

# into the volume, rotating 7 deep
docker compose --profile ops run --rm ops scripts/backup_data.py --keep 7

# offsite, encrypted, onto the host
docker compose --profile ops run --rm -e AA_BACKUP_PASSPHRASE ops \
scripts/backup_data.py --encrypt --output /export

docker compose --profile ops run --rm ops \
scripts/backup_data.py --verify /export/agentasian-<stamp>.zip.enc

For the nightly job the supervisor used to run, put the first command in the host's cron. Nothing inside the stack schedules it.

Restore requires Central and Brain to be stopped, and you must do that yourself. restore_data.py proves the stack is down two ways and only one of them survives containerization:

  • The flock on forge.sqlite3.lock still works. Both containers share one kernel and one inode on the volume, so it contends correctly.
  • The TCP probes of 8080 and 8081 do not. Each container has its own network namespace, so the probe sees nothing whether or not the services are up. This is the same namespace-local blindness the script's comments already describe for WSL.

The port probe is what guards Brain, which takes no process lock and writes chroma/ through a persistent client. Chroma has no second copy anywhere.

docker compose stop central brain
docker compose --profile ops run --rm ops scripts/restore_data.py /export/<archive>
docker compose start central brain

7. Cut the workers over​

On each Mac, point FORGE_CENTRAL_URL and BRAIN_API_URL at the Docker host and restart:

launchctl kickstart -k gui/$(id -u)/com.airwavetech.forge-worker

Nothing else changes. Worker identity is a token hash inside forge.sqlite3, which travelled with the restore, so registrations stay valid and any retained outbox drains once into the new Central.

Project paths keep working across the move. validate_project_path treats a path whose flavor does not match the host as foreign, prefix-matches it against SE_MANAGER_ALLOWED_PROJECT_ROOTS as a pure path, and never resolves it, so a containerized Central still routes both the Mac and the Windows roots you have registered.

8. What changes behaviorally​

POST /cpmi/index only sees what is mounted. It reads project files off Brain's own disk. On the desktop that included every checkout under C:\projects\github; in a container it includes nothing unless you mount it. The worker push path is unaffected, and it is the main path: a worker sends file contents before every task, so a project is indexed on its next run. To keep local indexing, add a read-only mount to the brain service:

- /srv/github:/srv/github:ro

The image pins the Python version. Central and Brain run 3.12 in the container regardless of what the host has.

Logs move. Service logs go to the Docker log driver, not to <data_root>/logs. Task logs written by Central still land in the volume.

9. What has not been verified​

The image was not built and the stack was not started. There is no Docker daemon reachable from the WSL distro this was written in. What was checked: docker-compose.yml parses and every service resolves to string volume entries; the guard change imports and its four new tests pass; the full suite is green.

Before trusting this in production, build it, run it against a scratch volume, and rehearse a restore drill into --data-dir /tmp/restore-drill.