Docker Compose across git worktrees

Each branch runs its own isolated stack with ports, containers, and database namespaces allocated automatically from a managed pool. No collisions, no manual port juggling, no stepping on your teammates' running services.

$curl -fsSL https://docktree.dev/install.sh | sh
Docs →
$npx skills add Bnjoroge1/Docktree

Built for modern local development

Docktree enables workflows that were previously painful or impossible when running a single Docker Compose instance — all with zero modifications to your existing compose files.

Parallel AI Agents

Run multiple coding agents in separate worktrees without port, container, volume, or database collisions. Each agent gets its own isolated Compose stack.

Review Multiple PRs Locally

Check out several pull requests as worktrees and run them side by side. Compare UI, API behavior, and database changes without constantly tearing stacks down.

E2E Testing in CI & Local

Run end-to-end test suites against multiple feature branches concurrently. Because each branch gets its own database schema and isolated port bindings, tests will never collide or taint shared state.

External Sharing & Preview

Expose any local worktree stack externally using docktree tunnel. Share your running feature branch live with product managers, developers, or clients for reviews, without configuring port forwarding.

Multi-Branch Development

Compare frontend changes, debug API integration issues, or work on hotfixes in a separate git worktree without having to tear down, rebuild, and restart your main development container stack.

Tenant Database Isolation

Share heavy infra like databases or message brokers once at the platform tier, while automatically provisioning clean, isolated tenant namespaces or database schemas for every git worktree.

Both apps below are running simultaneously in separate worktrees. Each has its own URL, its own containers, and its own database namespace.

2 worktrees running concurrently
shopping-cart.docktree.local

△ Shop

worktree: feature/shopping-cart

Mechanical Keyboard$129.00
USB-C Hub$39.00
4K Monitor$349.00
Desk Lamp$59.00
Webcam$89.00
Cart (0)$0.00
auth.docktree.local

△ Auth

worktree: feature/user-auth

See it in action

Commands cycle automatically. Click a tab to jump to a specific command.

~/myproject — zsh

Port allocation, isolation, cleanup

01

Allocate

Each worktree gets unique ports from a managed pool (41000–49999). The registry prevents collisions across all worktrees in the repo.

02

Isolate

Docktree generates a Compose override with unique project names, container names, and volumes. Shared databases get per-worktree tenant namespaces.

03

Clean up

When worktrees are removed or go idle, docktree clean reclaims ports, removes orphaned containers, networks, and volumes.

For AI agents

Docktree ships skills for Claude Code, Codex, Cursor, OpenCode, OMP/Pi, and 60+ other agents.

docktree skill

Teaches your agent which commands honor --json, the error envelope format, lifecycle gotchas, and common multi-worktree workflows.

docktree-init skill

Walks your agent through docktree init to generate a docktree.yml — scanning compose files and deciding on shared services and tenancy modes.

install skills
$ npx skills add Bnjoroge1/Docktree
# install globally for a specific agent
$ npx skills add Bnjoroge1/Docktree -g -a claude-code

Full agent skills guide →