r/podman • • 9d ago

One rootless Podman container per git worktree: how I moved my coding agents' builds to a spare machine

I run several coding agents in parallel, each in its own git worktree, and they were all compiling and testing on one machine. I had Claude Code build a small tool, boxd, that moves those builds to a spare machine, and rootless Podman does most of the real work. Sharing it here because the Podman side may be useful to others.

How Podman is used

  • One container per git worktree, created on the first call and reused afterwards, so caches stay warm. The agent types box make test and the command runs in that worktree's container over ssh.
  • Everything is rootless, under one unprivileged build account. That account can only reach a small dispatcher through a dedicated sshd; it has no shell on the host.
  • Each container gets --init, its own --memory, --memory-swap and --pids-limit, and all of them sit under one control group with a single memory cap, so a dozen agents cannot take the host down together.
  • For tools that refuse to run as root, a box can run as a normal user with --userns=keep-id.
  • A box can be built from a Containerfile in the worktree; editing the file replaces the container and keeps the files.
  • Container images may only come from registries the host allows.
  • Idle containers are removed after 30 minutes, and the container of a deleted worktree is removed with its files.

When an agent needs to run containers itself (podman or docker inside), the box is a small virtual machine instead, so nothing nested runs in the rootless container.

Honest notes: it is a few days old in public, all the code was written by Claude Code, and the hosts are packaged for Void Linux and Debian 13 only.

MIT license: https://github.com/gsalucci/boxd

I would be glad to hear what you would do differently on the Podman side, especially around limits for many short-lived containers.

15 Upvotes

0 comments sorted by