How to run an agent in a Docker container
This guide shows how to declare an agent that runs inside a Docker container, so that Sidekicks talks with it, shows its files and opens a terminal in it. It assumes Docker is installed and that you have an image containing the agent's program (for instance mm, built for Linux).
What Sidekicks needs
Three settings work together:
| Setting | Role |
|---|---|
command and args |
how the agent is started: docker exec -i <container> <program> <arguments>. Sidekicks talks with it over stdin and stdout (ACP), so -i is required and -t must not be used. |
workspace |
the agent's folder on this computer. The command is started there, and the agent receives this same path as the working folder of its sessions — so it must also exist at the same path inside the container. |
runtime |
where its files and terminal are: {type: container, container: <container>}. |
Steps
-
Start the container with the agent's folder mounted at the same path, and an init process (it cleans up the programs the terminal ends):
AGENT_DIR=/Users/me/agents/scout # the agent's folder on this computer docker run -d --init --name scout-box \ -v "$AGENT_DIR:$AGENT_DIR" -w "$AGENT_DIR" \ my-agent-image sleep infinity -
Check that the program runs and sees the folder:
docker exec scout-box sh -c 'command -v mm; pwd; ls' -
In Settings, add the agent and save:
agents: - name: scout title: Scout (Docker) icon: "🐳" command: docker args: [exec, -i, scout-box, mm, -acp] workspace: /Users/me/agents/scout runtime: type: container container: scout-box -
Start the agent from the Agents panel (▶), or write to it: it answers from the container. 📂 shows
container scout-box · /Users/me/agents/scout, its files and a terminal.
Variants
- Sidekicks opened from the Finder: such an application gets a short
PATHand may not finddocker. Write its full path (command: /usr/local/bin/docker, seewhich docker), or addenv: {PATH: "…"}to the agent. The files and the terminal find Docker by themselves. - The model server runs on this computer (llmman, Ollama…): inside the container,
localhostis the container itself; usehost.docker.internalin the agent's own configuration. - The folder is mounted elsewhere in the container: set
runtime.workspacePathto that path for the files and the terminal. The agent's sessions still receiveworkspaceas their working folder, so prefer the same path. - An existing container: any running container works, as long as it has the program and the folder;
docker psgives its name.
See also
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|