Container images
pandra sync prepares everything a run needs while the image builds: the package, the harness, and the agent's environment. The container then starts the agent with pandra run --offline, which fetches nothing. The container starts without waiting for downloads, and a registry or a Git host that cannot be reached does not stop it. Secrets come only when the container starts:
- Build: in the Dockerfile,
pandra syncprepares the agent's package, its harness, and its agent environment, and the image keeps them. - Start:
docker runstarts the container, whose entry pointpandra run --offlineruns the prepared agent. - Supply: the secrets, the workspace, and the prompt arrive when the container starts, so the image holds no credential.
An image of your own agent
Pandra does not build container images itself: you run it in a Dockerfile. To build the image from the agent's project, follow these steps in the Dockerfile:
- Copy
pandra.tomlandpandra.lock, and runpandra sync --no-install-project.--no-install-projectskips building the agent's own package, whose files are not copied yet. The command fetches the locked sources and installs the harness in a layer that changes only with those two files. A rebuild after you edit the agent's instructions or skills then fetches nothing and installs no harness again. - Copy the rest of the project and run
pandra sync, which builds the package and prepares its agent environment. - Start the agent with
pandra run --offlineas the entry point.
FROM ghcr.io/pandra-io/pandra:0.1.0 AS pandra
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=pandra /pandra /usr/local/bin/pandra
ENV PANDRA_CONFIG_FILE=/etc/pandra/config.toml
COPY config.toml /etc/pandra/config.toml
WORKDIR /agent
COPY pandra.toml pandra.lock ./
RUN pandra sync --no-install-project --harness claude-code
COPY . .
RUN pandra sync --harness claude-code
ENTRYPOINT ["pandra", "run", "--offline", "--harness", "claude-code", "/agent"]ghcr.io/pandra-io/pandra:0.1.0is the official Pandra image, which holds only the binary, at/pandra. Choose a base image that has the runners your agent's MCP servers need (npx,uvx, ordocker),gitif the project has Git sources or is built inside a repository, andca-certificates, which the harness and MCP servers can need.- A package built from your own project needs no approval, so the Dockerfile has no
pandra agent trustline. config.tomlis a configuration file you prepared withpandra configcommands, such as the one in Review every pull request in CI. The image runs the project at/agent, so its agent settings go in[agents."/agent"]. To build the configuration in the image instead, see configure in the Dockerfile.- A project that pins no sources has no
pandra.lock: leave it out of the firstCOPY.
Run your own agent in a container builds a simpler image of your own agent step by step, with one pandra sync and no configuration file.
Configure in the Dockerfile
Instead of copying a config.toml, the Dockerfile can run the pandra config commands that write it: every setting has a command, and pandra config mcp set also records the server as allowed. The file's directory must exist first. pandra harness use fails until the file itself exists, so pandra config secret set, which creates the file, runs before it. pandra config target set and pandra config setup --file also create the file. pandra config mcp set reads the project to find the server, so it runs after COPY . .. For an agent whose github server takes a token, these lines take the place of the lines from COPY config.toml to the second pandra sync:
RUN mkdir -p /etc/pandra \
&& pandra config secret set github-token --env GITHUB_TOKEN \
&& pandra harness use claude-code@2.1.285
WORKDIR /agent
COPY pandra.toml pandra.lock ./
RUN pandra sync --no-install-project --harness claude-code
COPY . .
RUN pandra config mcp set github-prod --agent /agent --server github \
--secret Authorization=github-token --format Authorization='Bearer {}' \
&& pandra sync --harness claude-codepandra config secret set warns that GITHUB_TOKEN is not set during the build. Supply the value when the container starts as PANDRA_SECRET_GITHUB_TOKEN, as running the image shows: a GITHUB_TOKEN passed under its own name would reach the agent too. A copied file keeps the whole configuration in one file you review before the build; the commands keep it in the Dockerfile.
An image of someone else's agent
An image of an agent someone else published pulls and approves it, and pandra sync AGENT prepares it. Here the agent is a package from a registry, pinned by digest:
RUN --mount=type=secret,id=docker,target=/root/.docker/config.json \
pandra pull ghcr.io/acme/reviewer@sha256:<digest>
RUN pandra agent trust ghcr.io/acme/reviewer@sha256:<digest> \
&& pandra sync ghcr.io/acme/reviewer@sha256:<digest> --harness claude-code
ENTRYPOINT ["pandra", "run", "--offline", "--harness", "claude-code", "ghcr.io/acme/reviewer@sha256:<digest>"]pandra pull prints what the agent contains into the build log, and the approval stays in the image, so the container's runs ask nothing. A Git reference pinned to a full commit works the same way, in an image that has git.
For a private registry, the pull step mounts your Docker credentials as a build secret (docker build --secret id=docker,src=$HOME/.docker/config.json .), which never enters a layer. Mount a file that holds the login itself, since a credential helper it names must exist in the image. Do not run pandra auth login in a RUN step: the file it writes stays in the image's layer.
What pandra sync prepares
pandra sync installs the selected harness when it is missing, so the image needs no pandra harness install line; pin its version with pandra harness use to keep every rebuild on one. It also downloads the helper program for 1Password, Bitwarden, or AWS Secrets Manager when the configuration uses one. It never fetches or approves the agent and reads no secret value.
- A stored package that is not approved, or changed since its approval, fails
pandra syncbefore anything is installed. - A gap in the configuration, such as a missing input, is only a warning, because inputs often come from environment variables set where the image runs.
- With
--offline, or[harnesses] downloads = "manual", it installs no missing harness and fails withsync_incomplete, which lists each missing item, so aRUN pandra syncline never passes without its harness. Setdownloads = "manual"after the harness is installed, so the container never downloads one at start. - On Alpine, Claude Code's build needs
apk add libgcc libstdc++ ripgrep, and Pi is installed with npm (Pi).
Prepare the agent in the image that runs it: copying a prepared store between build stages or machines is not supported.
Running the image
Nothing prepared holds credentials or conversation state. Supply secrets when the container starts, through environment variables, mounted files, or a secret store, and pass the workspace and the prompt as arguments, which Docker adds to the entry point:
docker run --rm -v "$PWD:/work" -e ANTHROPIC_API_KEY \
-e PANDRA_SECRET_GITHUB_TOKEN my-reviewer-image --workspace /work \
--prompt "Review the code in this repository." --jsonPANDRA_SECRET_GITHUB_TOKEN supplies the value of the logical secret github-token and takes precedence over its source, so the image's configuration can name the same logical secrets as your laptop's without a password manager in the container (supplying a value without its store). --offline stops only Pandra's own fetches: the harness and MCP servers still use the network. Run a published agent with an MCP server in a container builds such an image step by step.