Skip to content

mischa-robots/multi-agent-docker

Repository files navigation

Multi-Agent Dev Environment

A single Docker Compose workspace for Claude Code, GitHub Copilot CLI, and OpenAI Codex, all sharing a common base image and the same workspace/ directory.


Repository Structure

.
├── Dockerfile.base      # Shared base: Ubuntu 24.04 + Node.js + Python 3 + Rust + bash
├── Dockerfile.claude    # FROM dev-base + Claude Code CLI
├── Dockerfile.copilot   # FROM dev-base + GitHub Copilot CLI
├── Dockerfile.codex     # FROM dev-base + OpenAI Codex CLI
├── docker-compose.yml   # All three agents + PostgreSQL
├── .gitignore
├── workspace/           # Shared project files — all agents mount this
├── claude-config/       # Persistent Claude Code auth - gitignored so no secrets can leak
├── copilot-config/      # Persistent Copilot CLI auth - gitignored so no secrets can leak
├── codex-config/        # Persistent Codex config - gitignored so no secrets can leak
├── commandhistory/      # Persistent command history - gitignored so no data can leak
│   ├── claude/
│   ├── copilot/
│   └── codex/
└── README.md

How the Base Image Works

Dockerfile.base builds a shared image called dev-base containing everything all three agents need: system packages, Node.js LTS, Python 3, Rust, pnpm, and yarn. Each agent Dockerfile starts with FROM dev-base and only adds its own CLI tool.

Benefits:

  • Common layers are built and cached once — not three times
  • Rebuilding one agent image is fast (only its own layer changes)
  • All agents run identical Node/Python/Rust versions
  • Disk space: shared layers are stored once by Docker

The base image uses plain bash with Ubuntu's default color prompt, tab completion (bash-completion), and persistent history — no heavy shell frameworks needed.


Quick Start

1. Create host directories

mkdir -p commandhistory/claude commandhistory/copilot commandhistory/codex

2. Build the base image first

docker build -f Dockerfile.base -t dev-base .

3. Build all agent images and start the containers

docker compose up --build -d

4. Open an interactive shell in any agent

docker compose exec -it claude-code bash
docker compose exec -it copilot bash
docker compose exec -it codex bash

5. Authenticate each agent (first time only)

All three agents use an interactive device code flow — no API keys or .env files needed. Auth is persisted in the *-config/ directories on the host and survive rebuilds.

Claude Code (inside claude-code container):

claude
# follow the interactive login flow

Claude

Copilot CLI (inside copilot-dev container):

copilot
# follow the interactive login flow

Copilot

Codex (inside codex-dev container):

codex
# follow the interactive login flow

Claude


Working Across Agents

All three containers mount the same ./workspace directory.

You can use the agents to work on different projects or together on one project.

Use Git as your coordination layer — commit before switching agents so you always have a clean handoff point:

# for example in claude-code: 
# checkout a new feature branch
git checkout -b feature-branch

# finish your task with claude code, review it, then commit
git add . && git commit -m "claude: add new feature"

# then merge the feature into the main branch
git checkout main
git merge feature-branch

A suggested task split based on each tool's strengths:

Agent Best for
Claude Code Architecture, refactoring, tests, large codebase understanding
Copilot CLI GitHub integration (issues, PRs, branches), multi-model tasks
Codex Focused code generation, OpenAI model preference

Security

Each agent runs in its own isolated container with separate memory and environment variables. Auth tokens and config are mounted into only the container that needs them — the Copilot config is invisible to the Claude and Codex containers, and vice versa.

The only shared surface between containers is the workspace/ directory (intentional) and the host network (localhost). No MCP servers, web search, or external tool access is configured by default, keeping the attack surface minimal for local development.


Useful Commands

# Start all containers
docker compose up -d

# Start only one agent
docker compose up -d claude-code

# Open a shell
docker compose exec -it claude-code bash

# Stop everything
docker compose stop

# Stop and remove containers
docker compose down

# Rebuild base image after changes
docker build -f Dockerfile.base -t dev-base .
docker compose up --build -d

# Remove everything including volumes (⚠️ deletes PostgreSQL data)
docker compose down -v

PostgreSQL

Available to all agents via localhost:5432 (host network mode).

Setting Value
Database quest_db
User quest_user
Password quest_passw0rd

Change the default credentials before using this in any shared or production environment!


License

MIT License

Copyright (c) 2026 Michael Schaefer https://github.com/mischa-robots/multi-agent-docker

About

A Docker setup for Claude Code, Codex and Copilot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors