DevContainer CLI
The DevContainer CLI lets you build and run CodeForge containers without VS Code. Use it when you prefer terminal-only workflows, work on headless servers, or need DevContainer support in CI/CD pipelines.
Install the CLI
Section titled “Install the CLI”npm install -g @devcontainers/cliRequires Node.js 16.13+ or 18+ (when installing via npm). Verify the installation with devcontainer --version.
Build and Start
Section titled “Build and Start”From your project root (where .devcontainer/ lives):
devcontainer up --workspace-folder .The first build takes several minutes — it pulls the base image, installs all features, and runs post-start setup. Subsequent starts reuse cached layers and complete in seconds.
Connect to the Container
Section titled “Connect to the Container”The recommended way to get a shell inside the container:
devcontainer exec --workspace-folder . zshThis uses the devcontainer CLI’s exec command, which respects the container’s configured user and environment. You can also use docker exec directly — run docker ps to find the container name:
docker exec -it <container-name> zshRun Commands
Section titled “Run Commands”Execute commands without entering an interactive shell:
# Run check-setup to verify the installationdevcontainer exec --workspace-folder . check-setup
# Launch a Claude Code sessiondevcontainer exec --workspace-folder . cc
# List installed toolsdevcontainer exec --workspace-folder . cc-toolsPort Forwarding
Section titled “Port Forwarding”VS Code auto-forwards container ports to your host automatically. The CLI does not. You need an explicit forwarding mechanism.
Recommended: Install devcontainer-bridge (dbr) for dynamic, automatic port forwarding that works with any terminal client. CodeForge pre-installs the container side — you only need the host daemon:
# On your host machinedbr host-daemonAlternative: Use SSH tunneling for specific ports:
ssh -L 7847:localhost:7847 <container-user>@<container-host>See Port Forwarding for the full setup guide and comparison of all forwarding mechanisms.
Key Differences from VS Code
Section titled “Key Differences from VS Code”| Capability | VS Code | DevContainer CLI |
|---|---|---|
| Port forwarding | Automatic | Manual — use dbr or SSH tunneling |
| Extensions panel | GUI in sidebar | Not available |
| Ports panel | Visual port management | Not available — use docker port or dbr |
| Terminal management | Integrated tabs | Manual — use tmux for parallel sessions |
| File editing | Built-in editor | Use your preferred editor (vim, nano, etc.) |
Rebuilding
Section titled “Rebuilding”When you change devcontainer.json or feature configurations, rebuild:
# Rebuild using cached layers (fast)devcontainer up --workspace-folder .
# Full rebuild from scratch (slow, but fixes cache issues)devcontainer up --workspace-folder . --remove-existing-containerStopping the Container
Section titled “Stopping the Container”The devcontainer CLI doesn’t have a dedicated stop command. Use Docker directly:
# Find the container namedocker ps
# Stop the containerdocker stop <container-name>
# Or stop and remove itdocker rm -f <container-name>- Use tmux for parallel sessions inside the container. CodeForge installs tmux by default — run
tmuxafter connecting to get split panes and persistent sessions. - Connect external terminals using the scripts in
.codeforge/scripts/—connect-external-terminal.sh(macOS/Linux) orconnect-external-terminal.ps1(Windows PowerShell). - Combine with
dbrfor the closest experience to VS Code — automatic port forwarding without needing VS Code running.
Next Steps
Section titled “Next Steps”- Your First Session — start using CodeForge with Claude Code
- Port Forwarding — detailed forwarding setup guide
- Installation — full installation walkthrough