safe-claude
v1.0.4
Published
Run Claude Code in secure Docker containers with multi-project support
Maintainers
Readme
Safe Claude
Run Claude Code in secure, isolated Docker containers with multi-project support.
🏠 Utilize Local Agents and Commands
- Copies your
~/.claude/{agents, commands, CLAUDE.md}for use in every project.
🔒 Security & Isolation
- Each project runs in its own isolated Docker container
🚀 Multi-Project Support
- Automatic container naming based on project directory
- Containers persist between sessions (start/stop automatically)
🛠️ Pre-installed Tools
- Search & Navigation: ripgrep (rg), fd, fzf, ast-grep
- Data Processing: jq (JSON), yq (YAML)
- Development: git, gh (GitHub CLI), tmux, vim, nano
- Shell: zsh with oh-my-zsh, powerline10k theme
- ccusage: Track your Claude Code use
- Node.js: Node 20 with npm
Installation
Option 1: Install via npm (Recommended)
# Global installation
npm install -g safe-claude
# Or local installation
npm install safe-claudeOption 2: Manual Installation
- Ensure Docker is installed and running
- Place the
safe-claudescript in your PATH or project directory - Make it executable:
chmod +x safe-claude
Usage
Basic Commands
# Run Claude Code in current directory, drop into docker shell
./safe-claude
# Show help
./safe-claude --help
# Remove current project container
./safe-claude --rm
# Remove ALL containers and images
./safe-claude --rm --all
# Save current container state to image
./safe-claude --saveFirst Time Setup
- Run
safe-claudein your project directory - The script builds the Docker image (one-time setup) and drops you into a
zshsession - Run
claude(pre-configured with--dangerously-skip-permissions) to authenticate - Exit the container and run
./safe-claude --saveto commit your configured state to the image - From now on,
safe-claudewill use your saved configuration in new project containers
Container Management
Container Naming
- Containers are named:
claude-dev-{directory-name} - Each project directory gets its own isolated container
- Containers persist between sessions (auto-start/stop)
Configuration Persistence
- Use
--saveto commit current container state to theclaude-devimage - Saved state includes installed packages, configuration, and authentication
- All new containers start from your saved image state
Mounted Directories
The script automatically mounts:
- Current directory →
/workspace/{directory-name}(working directory) - ~/.claude/commands → Shared slash command definitions
- ~/.claude/agents → Shared agent configurations
- ~/.claude/CLAUDE.md → Global user instructions (read-only)
Environment Variables
TERMandCOLORTERM- Preserved for proper terminal colors
Aliases
Pre-configured aliases in containers:
c- Shortcut forclaude --dangerously-skip-permissionsclaude- Runs with--dangerously-skip-permissionsflagnrd- Shortcut fornpm run build
CLAUDE.md suggestions
finding FILES? use 'fd'
finding TEXT/strings? use 'rg'
finding CODE STRUCTURE? use 'ast-grep'
interacting with JSON? use 'jq'
interacting with YAML or XML? use 'yq'