Overview
Get Container Use running with your coding agent in just a few minutes. This guide will walk you through installation, agent setup, and creating your first environment.
Make sure you have Docker and Git
installed before starting.
Installation
Choose your preferred installation method:
Recommended for macOS users - Homebrew will automatically install shell completions for you.
brew install dagger/tap/container-use
This will:
Install the latest cu binary
Add it to your $PATH
Install shell completions automatically
Verify Installation Universal installer - Works on Linux, macOS, and Windows (WSL).
curl -fsSL https://raw.githubusercontent.com/dagger/container-use/main/install.sh | bash
This script will:
Check for Docker & Git (required dependencies)
Detect your platform automatically
Install the latest cu binary to your $PATH
Provide shell completion installation instructions
Verify Installation Shell Completions After installation, follow the provided instructions to enable shell completions for your shell (bash, zsh, fish). For developers - Build the latest version from source code.
Prerequisites
Go 1.21 or later
Git
Docker
Build Steps git clone https://github.com/dagger/container-use.git
cd container-use
go build -o cu ./cmd/cu
sudo mv cu /usr/local/bin/
For detailed build instructions, see the CONTRIBUTING.md guide. Verify Installation
Agent Setup
Configure Container Use with your coding agent. Choose your agent below:
All agents use the same MCP server command: cu stdio
Claude Code
Cursor
Goose
Other Agents
Add MCP Configuration cd /path/to/repository
claude mcp add container-use -- < full path to cu comman d > stdio
Add Agent Rules (Optional) Save the CLAUDE.md file at the root of your repository: curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md
For maximum security, restrict Claude Code to only use Container Use tools: 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
Install MCP Server Use the one-click deeplink to install (requires Cursor and Container Use already installed): Add Agent Rules Add the rules file to your project or home directory: curl --create-dirs -o .cursor/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/cursor.mdc
Method 1: Configuration File Add to ~/.config/goose/config.yaml: extensions :
container-use :
name : container-use
type : stdio
enabled : true
cmd : cu
args :
- stdio
envs : {}
Method 2: Interactive Setup Then add a command line extension with cu stdio as the command. Method 3: Goose Desktop Paste this URL 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
Container Use works with many coding agents through the Model Context Protocol (MCP).
Complete Agent List See setup guides for all supported agents including Amazon Q Developer, VSCode, Cline, Qodo Gen, and more
Quick Setup for Any Agent Most agents follow this pattern:
Add MCP Server : Configure your agent to use cu stdio as an MCP server
Add Rules (Optional): Download agent rules from our repository
Verify : Ensure your agent recognizes Container Use tools
All agents use the same MCP server command: cu stdio
Your First Environment
Now let’s create your first containerized environment and see Container Use in action!
Setting Up a Demo Project
Let’s start with a fresh repository:
mkdir hello
cd hello
git init
touch README.md
git add README.md
git commit -m "initial commit"
Creating Your First Environment
Ask your agent to create something simple:
Create a hello world app in python using flask
Your agent will work in an isolated environment and respond with something like:
[agent creates the Flask app with styling and templates]
✅ The application is now running and accessible at: http://127.0.0.1:58455
🔍 You can view all the files using: `cu checkout fancy-mallard`
📋 You can view the development log using: `cu log fancy-mallard`
Navigate to the provided URL to see your app running!
Understanding What Happened
Notice that your local directory is still empty:
This is because the agent worked in an isolated environment . Your local files are untouched.
Exploring Environments
List all environments:
$ cu list
ID TITLE CREATED UPDATED
fancy-mallard Flask Hello World with Blue Design 2 minutes ago 1 minute ago
Viewing the Development Log
See exactly what your agent did with cu log:
$ cu log fancy-mallard
9e3a5c9d Write templates/index.html (2 minutes ago )
$ python app.py &
d94b6ab8 Write app.py (3 minutes ago )
$ mkdir -p templates
Reviewing the Code
See exactly what files were created with cu diff:
$ cu diff fancy-mallard
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..f88d1fb
--- /dev/null
+++ b/app.py
@@ -0,0 +1,10 @@
+from flask import Flask, render_template
+
+app = Flask ( __name__ )
+
+@app.route( '/' )
+def hello_world () :
+ return render_template ( 'index.html' )
+
+if __name__ == '__main__':
+ app.run ( host = '0.0.0.0', port = 5000 )
...
Exploring the Environment
Option 1: Check Out Locally
Bring the environment’s work into your local Git workspace:
$ cu checkout fancy-mallard
Switched to branch 'cu-fancy-mallard'
$ ls
README.md app.py templates/
Now you can explore the files in your IDE, make changes, or continue development.
Option 2: Drop Into the Container
Get a terminal inside the exact environment your agent used:
$ cu terminal fancy-mallard
● Attaching terminal
cu /workdir $ ls
app.py templates/
cu /workdir $ python app.py
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
This gives you the same Python environment, dependencies, and setup your agent used.
Merging the Work
Once you’re satisfied with the agent’s work, merge it into your main branch:
$ git checkout main
$ cu merge fancy-mallard
Updating 95bb17b..9e3a5c9
Fast-forward
app.py | 10 ++++++++++
templates/index.html | 20 ++++++++++++++++++++
2 files changed, 30 insertions ( + )
create mode 100644 app.py
create mode 100644 templates/index.html
Essential Commands
Here are the key commands you’ll use regularly:
# List all environments
cu list
# View what an agent did
cu log < environment-i d >
# See the code changes
cu diff < environment-i d >
# Check out the environment locally
cu checkout < environment-i d >
# Get a terminal in the container
cu terminal < environment-i d >
# Merge the work into your branch
cu merge < environment-i d >
Success! 🎉
You’ve successfully:
✅ Installed Container Use
✅ Configured your agent
✅ Created your first environment
✅ Explored the development process
✅ Learned the essential commands
Your coding agent now has its own containerized playground. No more babysitting - let your agents work safely and independently!
Next Steps