Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 41 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ Docker-based Claude Code CLI with full development capabilities and host isolati
# One-line install
curl -fsSL https://raw.githubusercontent.com/lroolle/claude-code-yolo/main/install.sh | bash

```


```bash
# Navigate to your project and run
cd ~/projects/my-project
claude-yolo .
claude-yolo
```

## ⚠️ CRITICAL SAFETY WARNING

Claude will have **FULL ACCESS** to the current workspace and ALL subdirectories.

Always `cd` to a specific project directory first!

**NEVER run `--yolo` mode in:**
- Your home directory (`$HOME`)
- System directories (`/`, `/etc`, `/usr`, etc.)
- Any directory containing sensitive data

Claude will have **FULL ACCESS** to the current directory and ALL subdirectories. Always `cd` to a specific project directory first!

## How It Works

Expand All @@ -42,21 +49,22 @@ The installer provides two commands:

```bash
# YOLO mode (Docker) - recommended
claude-yolo . # Run in current directory
claude-yolo # Run in current directory

# Using claude.sh for more control
claude.sh --yolo . # YOLO mode
claude.sh . # Local mode (no Docker)
claude.sh --auth-with api-key . # Use API key
claude.sh --auth-with bedrock . # Use AWS Bedrock
claude.sh --auth-with vertex . # Use Google Vertex AI
claude.sh --yolo # YOLO mode
claude.sh # Local mode (no Docker)
claude.sh --auth-with api-key # Use API key(may have to rerun `/login`)
claude.sh --auth-with bedrock # Use AWS Bedrock
claude.sh --auth-with vertex # Use Google Vertex AI
claude.sh --shell # Open shell in container
claude.sh --help # Show all options
```

## Authentication Methods

- **Claude App** (default): Uses `~/.claude` OAuth - `--auth-with claude`
- Run `/login` in claude-code, open the oauth link, then paste the code back in the terminal
- **API Key**: Set `ANTHROPIC_API_KEY` environment variable - `--auth-with api-key`
- If OAuth exists, use `/login` in Claude to switch to API key auth
- **AWS Bedrock**: Uses `~/.aws` credentials - `--auth-with bedrock`
Expand All @@ -71,7 +79,7 @@ For GitHub operations (creating PRs, managing repos), set the `GH_TOKEN` environ
export GH_TOKEN="ghp_xxxxxxxxxxxx"

# Now gh commands work in containers
claude-yolo .
claude-yolo
# Inside container: gh pr create, gh issue list, etc.
```

Expand All @@ -83,17 +91,20 @@ You can mount additional configuration files or directories using the `-v` flag:

```bash
# Mount Git configuration
claude-yolo -v ~/.gitconfig:/root/.gitconfig .
claude-yolo -v ~/.gitconfig:/root/.gitconfig

# Mount SSH keys (read-only)
claude-yolo -v ~/.ssh:/root/.ssh:ro .
claude-yolo -v ~/.ssh:/root/.ssh:ro

# Resume with SSH keys and tracing enabled
claude-yolo -v ~/.ssh:/root/.ssh:ro --trace --continue

# Multiple mounts
claude-yolo -v ~/tools:/tools -v ~/data:/data .
claude-yolo -v ~/tools:/tools -v ~/data:/data

# Mount custom tool configs
claude-yolo -v ~/.config/gh:/root/.config/gh .
claude-yolo -v ~/.terraform.d:/root/.terraform.d .
claude-yolo -v ~/.config/gh:/root/.config/gh
claude-yolo -v ~/.terraform.d:/root/.terraform.d
```

**Note**: Volumes mounted to `/root/*` are automatically symlinked to `/home/claude/*` for non-root user access.
Expand All @@ -106,6 +117,21 @@ claude-yolo -v ~/.terraform.d:/root/.terraform.d .
- **Request Tracing**: Debug with `--trace` flag using claude-trace
- **Docker Socket**: Optional mounting with `CLAUDE_YOLO_DOCKER_SOCKET=true`

## Docker Images

Claude Code YOLO is available from multiple container registries:

```bash
# GitHub Container Registry (recommended, primary)
docker pull ghcr.io/lroolle/claude-code-yolo:latest

# Docker Hub (fallback)
docker pull lroolle/claude-code-yolo:latest

# Use specific registry
DOCKER_IMAGE=lroolle/claude-code-yolo claude-yolo
```

## Manual Setup

```bash
Expand All @@ -117,7 +143,7 @@ cd claude-code-yolo
make build

# Run directly
./claude.sh --yolo .
./claude.sh --yolo
```

## Inspired by
Expand All @@ -126,4 +152,3 @@ make build
- **[meal/claude-code-cli](https://github.com/meal/claude-code-cli)** - Containerized Claude Code with ready-to-use Docker setup
- **[gagarinyury/claude-code-root-runner](https://github.com/gagarinyury/claude-code-root-runner)** - Root privilege bypass for Claude Code using temporary users
- **[textcortex/claude-code-sandbox](https://github.com/textcortex/claude-code-sandbox)** - Full sandbox environment with web UI and autonomous workflows

8 changes: 4 additions & 4 deletions claude-yolo
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ parse_args() {
echo " Can be used multiple times"
echo ""
echo "Examples:"
echo " claude-yolo . # Run Claude in YOLO mode"
echo " claude-yolo # Run Claude in YOLO mode"
echo " claude-yolo --inspect # Quick access to running container"
echo " claude-yolo --ps # See project containers"
echo " claude-yolo -v ~/.gitconfig:/root/.gitconfig . # Mount git config"
echo " claude-yolo -v ~/.ssh:/root/.ssh:ro . # Mount SSH keys read-only"
echo " claude-yolo -v ~/tools:/tools -v ~/data:/data . # Multiple mounts"
echo " claude-yolo -v ~/.gitconfig:/root/.gitconfig # Mount git config"
echo " claude-yolo -v ~/.ssh:/root/.ssh:ro # Mount SSH keys read-only"
echo " claude-yolo -v ~/tools:/tools -v ~/data:/data # Multiple mounts"
exit 0
;;
*)
Expand Down
22 changes: 11 additions & 11 deletions claude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e
# Claude Starter Script with Docker Support
# Runs Claude Code CLI locally or in a Docker container for safe execution

VERSION="0.2.0"
DOCKER_IMAGE="${DOCKER_IMAGE:-lroolle/claude-code-yolo}"
VERSION="0.2.2"
DOCKER_IMAGE="${DOCKER_IMAGE:-ghcr.io/lroolle/claude-code-yolo}"
DOCKER_TAG="${DOCKER_TAG:-latest}"

DEFAULT_ANTHROPIC_MODEL="sonnet-4"
Expand Down Expand Up @@ -69,15 +69,15 @@ show_help() {
echo "Available models: sonnet-4, opus-4, sonnet-3-7, sonnet-3-5, haiku-3-5, sonnet-3, opus-3, haiku-3, deepseek-r1"
echo ""
echo "Examples:"
echo " $0 . # Claude app auth (default)"
echo " $0 --auth-with api-key . # Use API key"
echo " $0 --auth-with bedrock . # Use AWS Bedrock"
echo " $0 --auth-with vertex . # Use Google Vertex AI"
echo " $0 --yolo . # YOLO mode with default auth"
echo " $0 --yolo --auth-with bedrock . # YOLO mode with Bedrock"
echo " $0 --yolo -v ~/.ssh:/root/.ssh:ro . # YOLO mode with volume mount"
echo " ANTHROPIC_MODEL=opus-4 $0 . # Use Opus 4 with default auth"
echo " GH_TOKEN=ghp_xxx $0 --yolo . # YOLO mode with GitHub CLI auth"
echo " $0 # Claude app auth (default)"
echo " $0 --auth-with api-key # Use API key"
echo " $0 --auth-with bedrock # Use AWS Bedrock"
echo " $0 --auth-with vertex # Use Google Vertex AI"
echo " $0 --yolo # YOLO mode with default auth"
echo " $0 --yolo --auth-with bedrock # YOLO mode with Bedrock"
echo " $0 --yolo -v ~/.ssh:/root/.ssh:ro # YOLO mode with volume mount"
echo " ANTHROPIC_MODEL=opus-4 $0 # Use Opus 4 with default auth"
echo " GH_TOKEN=ghp_xxx $0 --yolo # YOLO mode with GitHub CLI auth"
echo ""
}

Expand Down
60 changes: 39 additions & 21 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,34 @@ set -e

# Claude Code YOLO Quick Installer

INSTALL_DIR="$HOME/.local/bin"
SCRIPT_NAME="claude.sh"
YOLO_WRAPPER="claude-yolo"
DOCKER_IMAGE="lroolle/claude-code-yolo:latest"
DOCKER_IMAGE="ghcr.io/lroolle/claude-code-yolo:latest"
GITHUB_RAW="https://raw.githubusercontent.com/lroolle/claude-code-yolo/main"

echo "Claude Code YOLO Installer"
echo "=========================="
echo ""

# Create install directory if it doesn't exist
if [ ! -d "$INSTALL_DIR" ]; then
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
INSTALL_DIR="$HOME/.local/bin"
echo "Installing to: $INSTALL_DIR (user directory)"
elif [ -w "/usr/local/bin" ]; then
INSTALL_DIR="/usr/local/bin"
echo "Installing to: $INSTALL_DIR (system directory)"
else
INSTALL_DIR="$HOME/.local/bin"
echo "Installing to: $INSTALL_DIR (user directory)"
echo "Creating $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
fi

# Check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "warning: $INSTALL_DIR is not in PATH"
echo "Add this to your shell profile:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
# Check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "warning: $INSTALL_DIR is not in PATH"
echo "Add this to your shell profile:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
fi
fi

# Download claude.sh
Expand All @@ -40,12 +46,22 @@ chmod +x "$INSTALL_DIR/$YOLO_WRAPPER"
# Pull Docker image
echo ""
echo "Pulling Docker image..."
docker pull "$DOCKER_IMAGE"
if ! docker pull "$DOCKER_IMAGE"; then
echo "Failed to pull from GitHub Container Registry, trying Docker Hub..."
DOCKER_IMAGE_FALLBACK="lroolle/claude-code-yolo:latest"
docker pull "$DOCKER_IMAGE_FALLBACK"
echo ""
echo -e "\033[93mNOTE: Using Docker Hub fallback image\033[0m"
echo "To use Docker Hub by default, set: export DOCKER_IMAGE=lroolle/claude-code-yolo"
echo "Add this to your shell profile (.bashrc, .zshrc) to make it permanent"
fi

# Success message
echo ""
echo "✓ Installation complete!"
echo ""
echo "Scripts installed to: $INSTALL_DIR"
echo ""
echo "Commands available:"
echo "=================="
echo ""
Expand All @@ -60,15 +76,17 @@ echo ""
echo "2. Navigate to your project directory:"
echo " cd ~/projects/my-project"
echo ""
echo "3. Run Claude in YOLO mode:"
echo " claude-yolo ."
echo "3. Start with Claude YOLO:"
echo " claude-yolo # Run Claude with full permissions"
echo ""
echo "4. Or use claude.sh for more options:"
echo " claude.sh --help # Show all options"
echo " claude.sh . # Local mode"
echo " claude.sh --yolo . # YOLO mode"
echo " claude.sh -a . # API key mode"
echo " claude.sh --shell # Docker shell"
echo "4. Claude-yolo handles all features:"
echo " claude-yolo --auth-with bedrock # Use AWS Bedrock"
echo " claude-yolo --auth-with api-key # Use API key(may have to rerun \`/login\`)"
echo " claude-yolo --trace # Enable request tracing"
echo " claude-yolo -v ~/.ssh:/root/.ssh:ro # Mount SSH keys"
echo " claude-yolo --continue/--resume # Resume conversation"
echo " claude-yolo --inspect # Enter running container"
echo " claude.sh --help # Advanced options reference"
echo ""
echo "WARNING: Never run --yolo in your home directory or system directories!"
echo -e "\033[93mWARNING: Never run --yolo in your home directory or system directories!\033[0m"
echo ""
Loading