Skip to content

Conversation

@mg-dev25
Copy link
Contributor

@mg-dev25 mg-dev25 commented Sep 30, 2025

Description

This PR adds system dependencies and process management infrastructure needed for Claude Code to work properly inside the Docker sandbox. Without these packages and configurations, Claude Code crashes or outputs errors that break the workflow.

Commit 1: procps package and PATH configuration

  • Added procps package - provides ps command that Claude Code uses for diagnostics
  • Ensured system directories are included in PATH for proper command resolution

Commit 2: Node.js and neovim

  • neovim: Required for Claude Code file editing operations
  • Node.js LTS: Required for MCP (Model Context Protocol) servers to run. Many MCP servers are JavaScript/TypeScript-based and won't work without Node.js.
  • /root/.claude directory: Pre-creating this directory prevents permission errors when Claude Code writes its configuration files on first run.

Commit 3: EDITOR environment variable

  • Set EDITOR=nvim for proper editor detection in Claude Code
  • Prevents attempts to use missing editors during file operations

Commit 4: ccusage installation

  • Install ccusage CLI tool to enable Claude Code usage statistics and model detection
  • Resolves the "unknown" model display issue in the status bar
  • Tries multiple installation methods (bun, npm) with graceful fallback

Commit 5: Merge latest main

  • Merged latest changes from main branch to keep the feature branch up to date

Commit 6: Container process management and tooling

  • tini as PID 1: Prevents zombie processes and ensures proper signal propagation
    • Claude Code spawns numerous subprocesses (MCP servers, bash commands, tool executions)
    • Without proper init, terminated children become zombies that exhaust PIDs
    • Ensures SIGTERM reaches all processes for clean container shutdown
  • jq: Added for JSON parsing and validation of MCP server communication (JSON-RPC over stdio)
  • npm for ccusage: Switched from bun to npm for better compatibility. npm's mature package resolution ensures ccusage installs correctly with all native dependencies, prioritizing reliability over speed.
  • VIBEKIT_SANDBOX_ACTIVE=1: Runtime detection flag for sandbox-aware behavior
    • Enables file system restrictions, network feature detection, and enhanced logging

Why these belong in the Dockerfile

These are system-level dependencies and infrastructure that need to be baked into the Docker image:

  1. Required before any code runs: Process management (tini), system utilities (procps, jq), and runtime dependencies (Node.js, neovim) must be present when the container starts
  2. Performance: Installing them at runtime would slow down every container startup
  3. Reliability: Process management infrastructure (tini) is fundamental to container stability with long-running sessions and heavy subprocess spawning
  4. Image size increase is reasonable: ~70-75MB total (Node.js ~50MB, neovim ~10MB, procps ~5MB, tini ~100KB, jq ~1MB, ccusage ~5MB)

Testing

Tested with Claude Code inside the sandbox:

  • Process management commands work correctly
  • File editing works without errors
  • MCP servers can be installed and run successfully
  • No more crashes due to missing dependencies
  • Zombie processes are properly reaped during long sessions
  • Container shutdown cleanly terminates all spawned processes
  • Usage statistics display correctly in Claude Code status bar
  • JSON processing tools available for MCP debugging

Related Issue

Fixes #240

Checklist

  • I tested my changes
  • I reviewed my own code

…ctories

Add procps package to both Claude and CLI Docker containers to provide
process management utilities like ps, top, and kill.

Also ensure PATH environment variable includes system directories
(/usr/local/bin, /usr/bin, /bin) so that process utilities and other
system commands can be found and executed properly within containers.

This resolves issues where process monitoring commands fail due to
missing utilities or incorrect PATH configuration.
…upport

- Add neovim: Required by Claude Code for editing
- Add Node.js LTS: Required for MCP servers to run
- Create /root/.claude directory: Needed for Claude configuration files

These system dependencies complement the procps package already added,
ensuring Claude Code has all required tools to function properly.
@vercel
Copy link

vercel bot commented Sep 30, 2025

@mg-dev25 is attempting to deploy a commit to the Superagent Team on Vercel.

A member of the Team first needs to authorize it.

Install ccusage CLI tool to enable Claude Code usage statistics and model
detection in the sandbox environment. This resolves the "unknown" model
display issue in the status bar.

Tries multiple installation methods (bun, npm) with graceful fallback.
- Add tini as PID 1 for proper subprocess and signal handling
- Install jq for JSON processing in container
- Switch ccusage to npm install for better compatibility
- Add VIBEKIT_SANDBOX_ACTIVE=1 environment variable to identify sandbox
- Clean up whitespace in claude-auth-helper.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add system dependencies for Claude Code support in Docker sandbox

1 participant