Architecture
Caravanserai has three components: a control plane (cara-server), a per-node agent (cara-agent), and a CLI (caractrl). The control plane exposes an HTTP API. Agents connect to it, self-register, and poll for work. You interact with the system entirely through caractrl.
cara-server
The control-plane API server and controller manager. Accepts manifests, runs the scheduler, and exposes the REST API under
/api/v1/.cara-agent
Runs on every worker node. Self-registers with
cara-server, heartbeats regularly, and reconciles containers via the Docker daemon.caractrl
The command-line client. Sends API requests to
cara-server on your behalf. Supports apply, get, delete, port-forward, and version.Key concepts
Node
A node is a physical or virtual machine runningcara-agent. Nodes self-register with the control plane on startup. The scheduler only assigns work to nodes in the Ready state.
| State | Meaning |
|---|---|
Ready | Node is healthy and accepts new projects |
NotReady | Node has missed heartbeats; excluded from scheduling |
Draining | Node is being wound down; no new projects are assigned |
Project
A project is a workload definition — a set of containers (services) that must be co-located on a single node. Services share a Docker bridge network and resolve each other by service name, exactly like Docker Compose.Scheduling lifecycle
Every project moves through a defined set of phases from submission to termination.| Phase | Set by | Meaning |
|---|---|---|
Pending | Server | Accepted; awaiting the scheduler |
Scheduled | Scheduler | Node assigned; agent not yet confirmed |
Running | Agent | All containers are up |
Failed | Agent | Terminal error — inspect Conditions for details |
Terminating | Server | Deletion is in progress |
Terminated | Agent | All containers have been removed |
When to use Caravanserai vs Kubernetes
Use Caravanserai when you want to orchestrate Docker workloads across a small self-hosted cluster without the operational overhead of Kubernetes. It is a good fit for:- Homelabs and edge deployments with a handful of nodes
- Teams already familiar with Docker Compose who want multi-node scheduling
- Environments where Kubernetes’ resource requirements are prohibitive
Prerequisites
Before you install Caravanserai, make sure the following are available on your machine:- Go 1.22+ — required to build the binaries from source
- Docker — the agent reconciles containers through the Docker daemon (
unix:///var/run/docker.sockor viaDOCKER_HOST) - PostgreSQL — required by
cara-serverto persist cluster state (connection passed viaDATABASE_URL)