This section explains how to use the Claude Code devcontainer with VS Code's Dev Containers extension for a seamless development experience.
- VS Code installed on your host machine
- Podman installed and running
- Dev Containers extension for VS Code
- The devcontainer setup script
- Open VS Code
- Press
Ctrl/Cmd + Shift + Xto open Extensions - Search for "Dev Containers"
- Install the official Microsoft extension:
- Name: Dev Containers
- ID:
ms-vscode-remote.remote-containers - Publisher: Microsoft
Since you're using Podman instead of Docker, configure VS Code to use Podman:
- Open VS Code settings (
Ctrl/Cmd + ,) - Search for "dev.containers.dockerPath"
- Set the value to
podman
Alternatively, add to your VS Code settings.json:
{
"dev.containers.dockerPath": "podman",
"dev.containers.dockerComposePath": "podman-compose"
}-
Prepare your project:
cd /path/to/your/project # Run the setup script to create .devcontainer files ./setup-devcontainer.sh setup
-
Open in VS Code:
# Open VS Code in the project directory code .
-
Reopen in Container:
- VS Code will detect the
.devcontainerfolder - You'll see a notification popup: "Folder contains a Dev Container configuration file"
- Click "Reopen in Container"
Or manually:
- Press
F1orCtrl/Cmd + Shift + P - Type: "Dev Containers: Reopen in Container"
- Press Enter
- VS Code will detect the
- Open VS Code
- Press
F1orCtrl/Cmd + Shift + P - Run: "Dev Containers: Clone Repository in Container Volume"
- Enter your repository URL
- VS Code will:
- Clone the repository
- Build the container
- Open the project inside the container
- Create a new folder for your project
- Copy the
.devcontainerfolder into it - Open the folder in VS Code
- Reopen in Container when prompted
When you open a project in a devcontainer:
Your Project/
βββ .devcontainer/ # Container configuration
β βββ devcontainer.json # VS Code settings
β βββ Dockerfile # Container image
β βββ init-firewall.sh # Security setup
βββ src/ # Your source code
βββ package.json # Node.js dependencies
βββ README.md # Your project docs
Inside the container, your project is mounted at /workspace.
- Automatically opens in the container
- Uses ZSH with Oh My Zsh by default
- Has access to all container tools (Node.js, Python, Claude Code)
The following extensions are automatically installed in the container:
- ESLint - JavaScript linting
- Prettier - Code formatting
- GitLens - Git supercharged
- Python (hardened version) - Python language support
- Pylance (hardened version) - Python language server
- VS Code automatically forwards ports from the container
- Access web servers running in the container from your host browser
- See forwarded ports in the "Ports" view (
View β Ports)
- All file operations happen inside the container
- File watchers work correctly
- Git operations use the container's git configuration
# In the VS Code terminal (inside container)
claude "help me create a REST API"- Set breakpoints in your code
- Use VS Code's debugging features as normal
- The debugger runs inside the container
Edit .devcontainer/devcontainer.json:
{
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"eamodio.gitlens",
// Add more extensions here
"github.copilot",
"ms-vscode.live-server"
]
}
}
}Add to .devcontainer/devcontainer.json:
{
"remoteEnv": {
"MY_API_KEY": "${localEnv:MY_API_KEY}",
"NODE_ENV": "development"
}
}Configure editor settings for the container:
{
"customizations": {
"vscode": {
"settings": {
"editor.fontSize": 14,
"editor.tabSize": 2,
"terminal.integrated.fontSize": 14,
"files.autoSave": "afterDelay"
}
}
}
}When you change the Dockerfile or devcontainer.json:
- Press
F1β "Dev Containers: Rebuild Container" - Or click the notification when VS Code detects changes
- Close the VS Code window
- The container stops automatically
- Your work is preserved in volumes
- Press
F1β "Dev Containers: Restart Container" - Useful after installing system packages
- Press
F1β "Dev Containers: Show Container Log" - Helpful for debugging container issues
-
Check Podman is running:
podman info
-
View detailed logs:
- Press
F1β "Dev Containers: Show Container Log"
- Press
-
Try rebuilding without cache:
- Press
F1β "Dev Containers: Rebuild Container Without Cache"
- Press
-
Reload window:
- Press
F1β "Developer: Reload Window"
- Press
-
Check extension compatibility:
- Some extensions only work on certain platforms
- Check the extension's documentation
-
Increase container resources:
# Edit the setup script to increase limits readonly MAX_MEMORY="8g" readonly MAX_CPU="4"
-
Exclude large folders from file watching:
{ "files.watcherExclude": { "**/node_modules/**": true, "**/.git/objects/**": true } }
- The container runs as
nodeuser - Use
sudofor system-level operations - Check file ownership:
ls -la
Create .vscode/settings.json in your project:
{
"remote.containers.defaultExtensions": [
"dbaeumer.vscode-eslint"
],
"remote.containers.workspaceMountConsistency": "cached"
}- Keep heavy files (videos, large datasets) outside the workspace
- Use
.dockerignoreto exclude unnecessary files - Enable file system caching for better performance on macOS
- Commit the
.devcontainerfolder to your repository - Team members can use the same development environment
- Include a note in your README about using Dev Containers
Create different configurations for different scenarios:
.devcontainer/
βββ devcontainer.json # Default
βββ backend/
β βββ devcontainer.json # Backend-specific
βββ frontend/
βββ devcontainer.json # Frontend-specific
Define tasks in .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Dev Server",
"type": "shell",
"command": "npm run dev",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}| Command | Description |
|---|---|
F1 β "Dev Containers: Reopen in Container" |
Open current folder in container |
F1 β "Dev Containers: Rebuild Container" |
Rebuild the container image |
F1 β "Dev Containers: Restart Container" |
Restart the running container |
F1 β "Dev Containers: Show Container Log" |
View container build/runtime logs |
F1 β "Dev Containers: Open Folder in Container" |
Open a different folder in container |
F1 β "Dev Containers: Attach to Running Container" |
Attach to an existing container |
- VS Code Dev Containers Documentation
- Dev Container Specification
- VS Code Remote Development
- Podman Desktop - GUI for managing Podman containers