Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Run Claude with dangerous permissions, sleep soundly 😴🌌. Docker sandbox with support for Cursor, tmux, Playwright, and Neovim.

License

Notifications You must be signed in to change notification settings

ykka/devvy-container

Repository files navigation

Devvy - Secure Development Container

A Docker-based development environment that runs Claude Code and development tools in isolation, accessible via VS Code/Cursor.

Why This Exists

Running Claude Code directly on your host machine gives AI unrestricted system access. This container provides:

  • Security: Claude Code runs isolated from your host system
  • Consistency: Linux environment for all npm packages and builds
  • Integration: Full VS Code/Cursor support with remote development

Quick Start

Prerequisites

  • Docker Desktop
  • Node.js 18+
  • VS Code/Cursor with Dev Containers extension

Installation

# Clone repository
git clone <your-repo-url> devvy-container
cd devvy-container

# Install CLI
npm install
npm run compile

# Run setup wizard
./devvy setup

The setup wizard will:

  • Collect your configuration (GitHub token, etc.)
  • Generate SSH keys for container access
  • Build the Docker image
  • Start the container

CLI Commands

devvy setup      # Initial setup wizard
devvy start      # Start container
devvy stop       # Stop container
devvy connect    # SSH into container
devvy cursor     # Launch Cursor attached to container (as devvy user)
devvy vscode     # Launch VS Code attached to container (as devvy user)
devvy status     # Check container status
devvy logs       # View container logs
devvy rebuild    # Rebuild container (preserves data)
                 # Options: --no-cache, --force, --accept-all
devvy cleanup    # Clean up Docker resources

Rebuild Command Options

The devvy rebuild command supports the following options:

  • --no-cache - Rebuild without using Docker's build cache
  • --force - Force rebuild even if container is currently running
  • --accept-all - Accept all prompts automatically (answer yes to all questions)

Example usage:

# Quick rebuild accepting all prompts
devvy rebuild --accept-all

# Force rebuild with fresh build (no cache)
devvy rebuild --force --no-cache --accept-all

Connecting VS Code/Cursor

Automatic Connection (Recommended)

# Launch Cursor and automatically attach as 'devvy' user
devvy cursor

# Launch VS Code and automatically attach as 'devvy' user
devvy vscode

# Open a specific folder
devvy cursor --folder /home/devvy/projects
devvy vscode --folder /home/devvy/projects

This command:

  • Configures Cursor/VS Code to connect as the devvy user (not root)
  • Opens the correct home directory (/home/devvy)
  • Ensures proper shell and terminal configuration

Manual Connection

  1. Start the container: devvy start
  2. Open VS Code/Cursor
  3. Press Cmd+Shift+P β†’ "Dev Containers: Attach to Running Container"
  4. Select devvy-container

Note: The container includes a .devcontainer/devcontainer.json that automatically configures VS Code to connect as the devvy user.

Project Structure

devvy-container/
β”œβ”€β”€ src/              # TypeScript CLI source
β”‚   β”œβ”€β”€ commands/     # CLI command implementations
β”‚   β”œβ”€β”€ services/     # Business logic
β”‚   └── config/       # Configuration management
β”œβ”€β”€ container-scripts/# Container initialization scripts
β”œβ”€β”€ secrets/          # SSH keys (git-ignored)
β”‚   β”œβ”€β”€ host_rsa          # Private key on local machine for SSH access to the container
β”‚   β”œβ”€β”€ host_rsa.pub      # Public key
β”‚   └── authorized_keys   # Container's authorized keys
└── .env             # Configuration (created during setup)

Configuration

The .env file (created during setup) contains:

# User/Group IDs
HOST_UID=1000
HOST_GID=1000

# Git configuration
GIT_USER_NAME="Your Name"
GIT_USER_EMAIL="[email protected]"

# Project path
PROJECTS_PATH=/Users/you/repos

# Optional services
GITHUB_TOKEN=ghp_...

Working with Projects

Your projects are mounted at:

  • Host: ~/repos/ (or your configured path)
  • Container: /home/devvy/repos/

Important: Always Run Commands in Container

# βœ… CORRECT - Inside container
devvy connect
cd ~/repos/your-project
npm install
npm run dev

# ❌ WRONG - On host machine
cd ~/repos/your-project
npm install  # This creates macOS binaries that won't work in Linux container

SSH Access

# Connect via SSH
ssh -p 2222 devvy@localhost -i ./secrets/host_rsa

# Or use the CLI (recommended)
devvy connect

Ports

Port Purpose
2222 SSH access
3000-3003 Development servers
60000-60010 Mosh (UDP)

Troubleshooting

Container won't start

devvy status         # Check current state
devvy logs          # View error logs
devvy rebuild       # Rebuild if needed

Permission issues

Ensure your user/group IDs are correct:

id -u  # Should match HOST_UID in .env
id -g  # Should match HOST_GID in .env

VS Code can't connect

  1. Ensure container is running: devvy status
  2. Check Docker Desktop is running
  3. Try: devvy stop && devvy start

After rebuild, SSH fails

The rebuild command handles SSH known_hosts automatically. If issues persist:

ssh-keygen -R "[localhost]:2222"
devvy connect  # Will prompt to verify new host key

Development

# Run quality checks
npm run quality     # TypeScript + linting
npm run format      # Auto-format code

# Build CLI
npm run build       # Compile TypeScript
npm run compile     # Build + make executable

# Development mode
npm run dev         # Run with hot reload

License

MIT

About

Run Claude with dangerous permissions, sleep soundly 😴🌌. Docker sandbox with support for Cursor, tmux, Playwright, and Neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •