You want to run multiple tasks in parallel with Claude Code, but you'd rather not have git worktree spawn a new directory every time. This post introduces "container-use," a tool that solves exactly that.
container-use is an MCP tool from Dagger. It creates isolated development environments inside containers on a per-branch basis, letting you do parallel development without polluting your local directory structure.
| Aspect | git worktree | container-use |
|---|---|---|
| Directories | A new directory is created | Isolated inside a container |
| Environment isolation | Files only | The whole environment |
| Work log | Only git history | Operation history via cu log |
| Compatibility with ghq | Tends to get messy | No impact |
sudo pacman -S dagger
yay -S container-use
For other OSes, see the official repository.
claude mcp add container-use -s user -- cu stdio
claude mcp list
If you see the following, you're good to go.
container-use: cu stdio - ✓ Connected
The official docs mark this as "optional," but without it Claude won't actually use container-use.
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md
If you'd rather not get a confirmation prompt every time, launch with the following options.
claude --allowedTools mcp__container-use__environment_checkpoint,mcp__container-use__environment_create,mcp__container-use__environment_add_service,mcp__container-use__environment_file_delete,mcp__container-use__environment_file_list,mcp__container-use__environment_file_read,mcp__container-use__environment_file_write,mcp__container-use__environment_open,mcp__container-use__environment_run_cmd,mcp__container-use__environment_update
| Command | Description |
|---|---|
cu list |
List environments |
cu log <env_id> |
View the work log |
cu checkout <env_id> |
Apply changes to a local branch |
cu open <env_id> |
Open an existing environment |
cu config |
Change settings like the base image |
Once development is done, pull the changes from the container into your local repo with:
cu checkout <env_id>
Here's a concrete example.
Open two terminals and start a separate Claude Code session in each.
$ claude
> Issue #42のバグを修正して
bash
$ claude
> Issue #58の機能を実装して
Each Claude works inside its own container-use environment, so they don't step on each other.
1. Claudeが作業完了を報告
↓
2. cu list で環境IDを確認
↓
3. cu checkout <env_id> で変更を取り込み
↓
4. 通常通りレビュー → マージ
The more efficient parallel development gets, the faster review requests pile up.
As noted above, if you don't append the contents of agent.md to CLAUDE.md, Claude won't recognize container-use. Keep in mind that this has to be set up per project.
With container-use, you can do parallel development in Claude Code without scattering directories the way git worktree does.
Particularly recommended if you keep your repositories nicely organized with ghq.
This post was written with AI assistance and reviewed by the author.