herdr
herdr is a terminal multiplexer for coding agents: Claude Code, Codex, OpenCode and the others run in its panes, its background server keeps them working when the client detaches, and its sidebar says which one is blocked. It is meant to run on the machine where the work lives, and it publishes no container image.
This example gives it one anyway, built from the stack itself, so the agents run in a container with no Docker socket and no access to the host, and you reach them from a Kaio shell on any server of the cluster.
1. Write the Compose file
Section titled “1. Write the Compose file”services: herdr: image: herdr-box:${HERDR_VERSION} build: context: . args: HERDR_VERSION: ${HERDR_VERSION} dockerfile_inline: | FROM docker.io/library/debian:bookworm-slim ARG HERDR_VERSION RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates curl git less procps \ && rm -rf /var/lib/apt/lists/* RUN curl -fsSL -o /usr/local/bin/herdr \ "https://github.com/herdrdev/herdr/releases/download/v$${HERDR_VERSION}/herdr-linux-$$(uname -m)" \ && chmod +x /usr/local/bin/herdr RUN useradd -m -u 1000 -s /bin/bash dev USER dev WORKDIR /home/dev command: ["herdr", "server"] init: true restart: unless-stopped environment: - TERM=xterm-256color - LANG=C.UTF-8 - SHELL=/bin/bash - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} volumes: - home:/home/dev
volumes: home:- The image is described by
dockerfile_inline, so the stack needs no file beside itscompose.yml:docker compose upbuilds it the first time, on whichever server the stack lands.$$keeps a$away from Compose interpolation for the shell inside the build.dockerfile_inlineneeds Docker Compose 2.17 or later. - The image tag carries the herdr version. Changing
HERDR_VERSIONnames an image that does not exist yet, which is what makes the next deploy rebuild it. - The container’s process is the headless herdr server, so
stack logsshows its startup and the stack state says whether it runs. Clients started in a shell find it on~/.config/herdr/herdr.sock. homeholds everything that has to outlive the container: herdr’s~/.config/herdrwith its saved session, the agents you install and their logins, and the repositories you clone.
2. Write its variables
Section titled “2. Write its variables”HERDR_VERSION=0.9.5ANTHROPIC_API_KEY=sk-ant-...ANTHROPIC_API_KEY is flagged as a secret
and only needed if Claude Code should use an API key rather than a login.
3. Deploy it
Section titled “3. Deploy it”kaio-cli stack deploy herdr ./compose.yml --env-file .envkaio-cli stack logs herdr --followThe first deploy downloads Debian and the herdr release and builds the image, so it takes longer than the next ones.
4. Attach
Section titled “4. Attach”kaio-cli container lskaio-cli container shell <id>herdrThe same shell opens from the container row in the web UI, or with ! in the
TUI. On another server of the cluster, prefix the command with
kaio-cli node prod-02 run.
Install an agent in a pane, clone a repository and start it:
curl -fsSL https://claude.ai/install.sh | bashgit clone https://github.com/you/project && cd projectclaudeTwo keys to tell apart: ctrl+b q detaches from herdr and leaves the agents
working, Ctrl-] then leaves the Kaio shell. Run herdr again from a new
shell to find them where they were.
5. Run it day to day
Section titled “5. Run it day to day”kaio-cli stack env set herdr HERDR_VERSION=0.9.6kaio-cli stack apply herdr # builds the new image, recreates the containerkaio-cli stack versions herdrkaio-cli stack rollback herdr 1 # back to the previous herdr imageRecreating or restarting the container stops the herdr server and the
processes in its panes. The server saves the session on its way down and
restores the layout from ~/.config/herdr when it starts again, and agents
with a herdr integration resume their conversation: see
Session state and restore. Detach
before an apply rather than in the middle of a task.
stack check-update and stack update compare an image with its registry,
and herdr-box is built by the stack and lives in no registry, so the check
leaves it out: the version in HERDR_VERSION is what moves it.
Moving it to another server
Section titled “Moving it to another server”kaio-cli stack copy herdr --to prod-02 --with-volumeskaio-cli node prod-02 run stack restart herdrThe home volume carries the session, the logins and the clones, and
prod-02 builds the image from the same compose.yml. Stop the source first:
two copies of a logged-in agent working on the same repository will step on
each other.
Kaio, built by Régis Gaidot