Docker Compose
Run AgentShield with Docker Compose. Data services, the app profile, the observability profile, configuration overrides, and lifecycle commands.
docker-compose.yml at the repository root describes the whole stack. Profiles let you start only what you need.
Development credentials
Compose uses known development values and binds every published port to 127.0.0.1. It is for workstations and CI. For shared environments, use the Kubernetes production overlay or equivalent hardening.
Profiles
| Command | Services |
|---|---|
docker compose up -d | PostgreSQL, Redis, NATS (JetStream), MinIO, MinIO bucket init, Mailpit |
docker compose --profile app up -d --build | Also: intelligence, gateway, event-relay, control-plane, dashboard |
docker compose --profile app --profile observability up -d --build | Also: Prometheus and Grafana |
Start the full stack
docker compose --profile app up -d --build
docker compose --profile app run --rm control-plane node apps/control-plane/dist/bootstrap.js
docker compose ps| URL | Service |
|---|---|
http://127.0.0.1:3000 | Dashboard |
http://127.0.0.1:8080 | Control plane API |
http://127.0.0.1:8081 | Gateway API |
http://127.0.0.1:8082 | Intelligence engine |
http://127.0.0.1:8083 | Event relay health |
http://127.0.0.1:8025 | Mailpit (catches invitation email) |
http://127.0.0.1:9001 | MinIO console |
http://127.0.0.1:8222 | NATS monitoring |
http://127.0.0.1:9090, :3001 | Prometheus, Grafana (observability profile) |
How services are wired
- The gateway connects to
postgres,redis, andintelligenceon the Compose network, withINTELLIGENCE_URL=http://intelligence:8082. - The event relay connects to
postgres,nats, andminio, and writes to theagentshield-evidencebucket created byminio-init. - The control plane connects to
postgres,minio(evidence reads), andmailpit(SMTP_URL=smtp://mailpit:1025). - The dashboard reaches the control plane at
http://control-plane:8080. - Services wait for their dependencies' health checks before starting.
In development, Compose connects services as the schema owner, which bypasses row level security. The Kubernetes dev overlay uses agentshield_app everywhere if you want to exercise RLS locally.
Hardening applied
Every application container runs with:
read_only: true
security_opt: ["no-new-privileges:true"]
cap_drop: ["ALL"]and as a non-root user, with a health check. Base images are pinned by digest.
Enable http.request
The gateway registers only sample.echo unless GATEWAY_TOOLS_CONFIG names a file inside the container. Mount one with an override file:
services:
gateway:
volumes:
- ./docs/examples/gateway-tools.json:/etc/agentshield/gateway-tools.json:ro
environment:
GATEWAY_TOOLS_CONFIG: /etc/agentshield/gateway-tools.json
AGENTSHIELD_GITHUB_AUTHORIZATION: ${AGENTSHIELD_GITHUB_AUTHORIZATION}The example file injects a GitHub credential, so the gateway refuses to start until AGENTSHIELD_GITHUB_AUTHORIZATION is set, for example to Bearer <token>.
Override settings
Copy .env.example to .env to change ports or development credentials:
cp .env.example .envSee Environment variables for every Compose variable.
Migrations
PostgreSQL applies every file in infrastructure/docker/postgres/migrations/ in lexical order when the data volume is first created. An existing volume does not pick up new files. To apply a newer migration to an existing volume:
docker compose exec -T postgres psql -U agentshield -d agentshield \
< infrastructure/docker/postgres/migrations/0006_event_pipeline.sqlEach migration is safe to run twice. Check schema_migrations to see which are applied.
Lifecycle
docker compose --profile app logs -f gateway # follow one service
docker compose --profile app restart gateway # restart after config changes
docker compose --profile app down # stop, keep volumes
docker compose --profile app down -v # stop and delete all local dataImplementation references
Was this page helpful?