Run Claude Code inside an isolated Docker container with access to only one folder on your machine. Claude can only read and write files within that folder — nothing else on your host machine is accessible.
Why use this? Claude Code is a powerful autonomous agent that can read, write, and delete files. Running it directly on your machine gives it access to your home directory, credentials, and other sensitive data. This project eliminates that risk by sandboxing Claude inside a container where only a single folder you choose is ever visible.
Security Model The container has no access to your home directory, credentials, or other files. Only the folder you explicitly mount is visible to Claude. Within the mounted folder Claude can write/delete/corrupt everything with no restrictions.
- Docker installed on your host machine
- An Anthropic Pro / Max account
Just open the application as you would open any application.
# this will create a folder safe-claude in your current working directory with all code from this repository
git clone https://github.com/nateso/safe-claude.git
# enter the folder
cd safe-claudemacOS / Linux:
./install.shWindows (PowerShell):
powershell -ExecutionPolicy Bypass -File install.ps1The installer will:
- Check that Docker is running
- Build the
safe-claudeDocker image (takes a few minutes the first time) - Install the
safe-claudecommand to a directory on your PATH
macOS / Linux:
safe-claude /path/to/your/projectWindows:
safe-claude C:\path\to\your\projectThat's it. The command will:
- Create a new container, which with the specified folder as volume.
- Start the container
- Drop you into a claude session inside the container with
/workspacepointing to your folder.
Each folder gets its own container. The container name is derived deterministically from the folder path (e.g. safe-claude-myproject-a3f2b1c8), so running safe-claude /path/to/your/project always connects to the same container.
If you prefer to manage Docker manually, here are the individual steps:
# build the image
docker build -t safe-claude .
# create the container
docker run -dit --name your_container_name \
-v /path/to/your/folder:/workspace \
safe-claude
# enter the container
docker exec -it your_container_name /bin/bash
# Run claude inside the container
claudeReplace /path/to/your/folder with the local directory you want Claude to work in and your_container_name with a name of your choice.
You will notice you are inside the container because your command line path will say something like root@123456f338bb:/workspace.
To exit the container, type exit or press Ctrl+D.
- Node.js 20
- Claude Code (
@anthropic-ai/claude-code) - Python 3 + Conda (Miniconda)
- R
- Common build tools