Development environment management tool that enables AI coding agents to work in isolated and safe containerized environments
Container Use lets each of your coding agents have their own containerized environment. Go from babysitting one agent at a time to enabling multiple agents to work safely and independently with your preferred stack.
It's an open-source MCP server that works as a CLI tool with Claude Code, Cursor, and other MCP-compatible agents.
git checkout <branch_name>
to review any agent's work.🦺 This project is in early development and actively evolving. Expect rough edges, breaking changes, and incomplete documentation. But also expect rapid iteration and responsiveness to feedback.
curl -fsSL https://raw.githubusercontent.com/dagger/container-use/main/install.sh | bash
This will check for Docker & Git (required), detect your platform, and install the latest cu
binary to your $PATH
.
To build the cu
binary without installing it to your $PATH
, you can use either Dagger or Go directly:
go build -o cu ./cmd/cu
dagger call build --platform=current export --path ./cu
Enabling container-use
requires 2 steps:
container-use
corresponding to the repository.Add the container-use MCP:
cd /path/to/repository
npx @anthropic-ai/claude-code mcp add container-use -- <full path to cu command> stdio
Save the CLAUDE.md file at the root of the repository. Alternatively, merge the instructions into your own CLAUDE.md.
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md
Add this to ~/.config/goose/config.yaml
:
extensions:
container-use:
name: container-use
type: stdio
enabled: true
cmd: cu
args:
- stdio
envs: {}
curl --create-dirs -o .cursor/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/cursor.mdc
The result of the instructions above will be to update your VSCode settings with something that looks like this:
"mcp": {
"servers": {
"container-use": {
"type": "stdio",
"command": "cu",
"args": [
"stdio"
]
}
}
}
Once the MCP server is running, you can optionally) update the instructions for copilot using the following:
curl --create-dirs -o .github/copilot-instructions.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
Kilo Code
allows setting MCP servers at the global or project level.
{
"mcpServers": {
"container-use": {
"command": "replace with pathname of cu",
"args": [
"stdio"
],
"env": {},
"alwaysAllow": [],
"disabled": false
}
}
}
Example | Description |
---|---|
hello_world.md | Creates a simple app and runs it, accessible via localhost HTTP URL |
parallel.md | Creates and serves two variations of a hello world app (Flask and FastAPI) on different URLs |
security.md | Security scanning example that checks for updates/vulnerabilities in the repository, applies updates, verifies builds still work, and generates patch file |
cat ./examples/hello_world.md | claude --dangerously-skip-permissions
goose run -i ./examples/hello_world.md -s
vscode
Prompt as in parallel.md
but add a sentence 'use container-use mcp'
Your agents will automatically commit to a container-use remote on your local filesystem. You can watch the progress of your agents in real time by running:
cu watch
container-use is an Model Context Protocol server that provides Environments to an agent. Environments are an abstraction over containers and git branches powered by dagger and git worktrees. For more information, see environment/README.md.