> ## Documentation Index
> Fetch the complete documentation index at: https://docs.concatflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run with Docker Compose

> Keep the agent next to your other services, with its token and database URL out of the file.

Use Compose when the agent should live in the same stack as your database or your other services.

**1. Write the service**

Save this as `compose.yaml`:

```yaml compose.yaml theme={"system"}
services:
  cubit-agent:
    image: ghcr.io/usecubit/source-client:0.1.0
    restart: unless-stopped
    hostname: db-agent-1
    environment:
      CUBIT_API_URL: https://api.concatflow.com
      CUBIT_ENROLL_TOKEN: ${CUBIT_ENROLL_TOKEN}
      DATABASE_URL: ${DATABASE_URL}
    volumes:
      - cubit-agent:/data

volumes:
  cubit-agent:
```

No `ports:` section. The agent listens on nothing.

**2. Put the secrets in `.env`**

Next to `compose.yaml`, create `.env` and keep it out of version control:

```bash .env theme={"system"}
CUBIT_ENROLL_TOKEN=<your-token>
DATABASE_URL=postgresql://concatflow_reader:<password>@<host>:5432/app
```

If the database runs in the same Compose project, use its service name as `<host>`.

**3. Start it**

```bash theme={"system"}
docker compose up -d
docker compose logs cubit-agent
```

Look for `serving dataset` in the logs.

After the first start, the agent reads its credentials from the `cubit-agent` volume and ignores `CUBIT_ENROLL_TOKEN`. You can remove the token from `.env`.

> [!WARNING]
>
> `docker compose down -v` deletes the volume, and the agent's enrollment with it. Use `docker compose down` without `-v` to keep it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.