A minimal, secure devcontainer setup for development with Claude Code in VSCode.
- Node.js 20 base environment
- Claude Code CLI pre-installed (latest version)
- Development tools: git, zsh with Oh My Zsh, fzf, git-delta, GitHub CLI, vim, nano
- VSCode extension: Claude Code
- Network firewall: Restricts outbound connections to approved domains (GitHub, npm, Anthropic API, etc.)
- Persistent volumes: Bash history and Claude config persisted across container rebuilds
The devcontainer includes a firewall (init-firewall.sh) that automatically restricts network access to specific approved domains. This provides a secure sandboxed environment for AI-assisted development.
The default shell is zsh with Oh My Zsh pre-configured with:
gitandfzfplugins- Persistent command history
- Customizable prompt (modify Dockerfile to add more plugins)
- Command history persists across container rebuilds
- Claude configuration directory (
~/.claude) is preserved in a named volume
- Click "Use this template" on GitHub to create a new repository
- Clone your new repository
- Open in VSCode with Dev Containers extension
- VSCode will build and start the devcontainer
# Clone this repo
git clone <this-repo-url> my-project
cd my-project
# Optional: Remove git history to start fresh
rm -rf .git
git init
git add .
git commit -m "Initial commit"
# Add your remote
git remote add origin <your-repo-url>Currently includes only Claude Code. To add more extensions, edit .devcontainer/devcontainer.json:
"extensions": [
"anthropic.claude-code",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]Edit .devcontainer/Dockerfile to add packages:
RUN apt-get update && apt-get install -y \
your-package-here \
&& apt-get clean && rm -rf /var/lib/apt/lists/*To allow additional domains, edit .devcontainer/init-firewall.sh and add domains to the appropriate list.
Git commit signing is not configured in this devcontainer. If you need signed commits:
- Recommended: Disable signing in the container by adding to
postStartCommand:git config --global commit.gpgsign false - Alternative: Set up GPG signing with GPG agent forwarding (more complex)
VSCode handles SSH agent forwarding automatically for git operations. Ensure your SSH keys are loaded in your host SSH agent before starting the container.
The following environment variables are configured:
NODE_OPTIONS="--max-old-space-size=4096"- Increases Node.js memory limitCLAUDE_CONFIG_DIR="/home/node/.claude"- Claude configuration directoryPOWERLEVEL9K_DISABLE_GITSTATUS="true"- Disables git status in prompt (performance)DEVCONTAINER="true"- Indicates running in a devcontainer
- Check Docker daemon is running
- Ensure you have enough disk space
- Try rebuilding:
Ctrl+Shift+P→ "Dev Containers: Rebuild Container"
- Check .devcontainer/init-firewall.sh
- Add your domain to the appropriate allowlist
- Rebuild the container
- Ensure you've authenticated: run
claude authin the terminal - Check your API key is valid
- Verify network connectivity to Anthropic API