README
ยถ
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. Check out the Container Use playlist to see examples of how others are using it.
It's an open-source MCP server that works as a CLI tool with Claude Code, Cursor, and other MCP-compatible agents.
- ๐ฆ Isolated Environments: Each agent gets a fresh container in its own git branch - run multiple agents without conflicts, experiment safely, discard failures instantly.
- ๐ Real-time Visibility: See complete command history and logs of what agents actually did, not just what they claim.
- ๐ Direct Intervention: Drop into any agent's terminal to see their state and take control when they get stuck.
- ๐ฎ Environment Control: Standard git workflow - just
git checkout <branch_name>to review any agent's work. - ๐ Universal Compatibility: Works with any agent, model, or infrastructure - no vendor lock-in.
๐ฆบ 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. Please submit issues and/or reach out to us on Discord in the #container-use channel.
Install
Homebrew (Recommended for MacOS)
brew install dagger/tap/container-use
Our tap should install shell completions for you.
All Platforms (Shell Script)
curl -fsSL https://raw.githubusercontent.com/dagger/container-use/main/install.sh | bash
This will check for Docker & Git (required), detect your platform, install the latest cu binary to your $PATH, and provide completion installation instructions.
For building from source, see CONTRIBUTING.md.
Integrate Agents
Enabling container-use requires 2 steps:
- Adding an MCP configuration for
container-usecorresponding to the repository. - (Optional) Adding a rule so the agent uses containarized environments.
Claude Code
Add the container-use MCP:
npm install -g @anthropic-ai/claude-code
cd /path/to/repository
claude 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
To trust only the Container Use environment tools, invoke Claude Code like this:
claude --allowedTools mcp__container-use__environment_checkpoint,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
Amazon Q Developer CLI chat
Add this container-use MCP config to ~/.aws/amazonq/mcp.json:
{
"mcpServers": {
"container-use": {
"command": "cu",
"args": [
"stdio"
],
"env": {},
"timeout": 60000
}
}
}
Save the agent instructions for Container Use to your project root at ./.amazonq/rules/container-use.md:
mkdir -p ./.amazonq/rules && curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md > .amazonq/rules/container-use.md
To trust only the Container Use environment tools, invoke Q chat like this:
q chat --trust-tools=container_use___environment_checkpoint,container_use___environment_file_delete,container_use___environment_file_list,container_use___environment_file_read,container_use___environment_file_write,container_use___environment_open,container_use___environment_run_cmd,container_use___environment_update
Goose
Add this to ~/.config/goose/config.yaml:
extensions:
container-use:
name: container-use
type: stdio
enabled: true
cmd: cu
args:
- stdio
envs: {}
or use goose configure and add a command line extension with cu stdio as the command.
For the Goose desktop, paste this into your browser:
goose://extension?cmd=cu&arg=stdio&id=container-use&name=container%20use&description=use%20containers%20with%20dagger%20and%20git%20for%20isolated%20environments"
Cursor
First, install the MCP server by using the deeplink below (this assumes you have Cursor and Container-use already installed):
Then, add the following rule, either at the root of your project or in your home directory (global).
curl --create-dirs -o .cursor/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/cursor.mdc
VSCode / GitHub Copilot
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
Zed
First add the agent rules file, either as .rules in the root of your project or as one of the other acceptable files/locations.
curl -o .rules https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
Then configure the Container Use MCP server in the Zed settings.json. Provide the absolute path to the cu executable:
"context_servers": {
"container-use": {
"source": "custom",
"command": {
"path": "/opt/homebrew/bin/cu",
"args": ["stdio"],
"env": {}
}
}
}
Next open the Zed Agent Panel โจ in the lower right and prompt away!
Cline
Add the following to your Cline MCP server configuration JSON:
{
"mcpServers": {
"container-use": {
"disabled": false,
"timeout": 60000,
"type": "stdio",
"command": "cu",
"args": [
"stdio"
],
"env": {},
"autoApprove": []
}
}
}
Qodo Gen
- Open Qodo Gen chat panel in VSCode or IntelliJ.
- Click Connect more tools.
- Click + Add new MCP.
- Add the following configuration:
{
"mcpServers": {
"container-use": {
"command": "cu",
"args": [
"stdio"
]
}
}
}
Include the container-use prompt in your Cline rules:
curl --create-dirs -o .clinerules/container-use.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
Kilo Code
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
}
}
}
OpenAI Codex
Codex allows setting MCP servers with the new experimental Rust version available here.
In your ~/.codex/config.toml, add the following:
[mcp_servers.container-use]
command = "cu"
args = ["stdio"]
env = {}
Warp
Warp 2.0 introduces coding agents!
In the Warp sidebar, under Personal, select MCP Servers and New:
{
"container-use": {
"command": "cu",
"args": ["stdio"],
"env": {},
"working_directory": null,
"start_on_launch": true
}
}
Gemini CLI
To use container-use with Gemini CLI, add the following JSON to your user settings ~/.gemini/settings.json or project settings .gemini/settings.json file.
Full documentation for the settings file can be found here
{
"coreTools": [],
"mcpServers": {
"container-use": {
"command": "cu",
"args": ["stdio"],
"timeout": 60000,
"trust": true
}
}
}
Examples
| 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 |
Run with Claude Code
cat ./examples/hello_world.md | claude --dangerously-skip-permissions
If you see a "Raw mode is not supported" error then run claude --dangerously-skip-permissions directly, accept the terms and try the above command again.
Run with Goose
goose run -i ./examples/hello_world.md -s
Run with Kilo Code in vscode
Prompt as in parallel.md but add a sentence 'use container-use mcp'
Watch your agents work
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
How it Works
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.