This guide walks you through running Claude Code inside a Daytona sandbox using the Daytona CLI.
Prerequisites
- Daytona account and API key (Get it from Daytona Dashboard)
- Local terminal (macOS, Linux, or Windows)
Install the Daytona CLI
brew install daytonaio/cli/daytonapowershell -Command "irm https://get.daytona.io/windows | iex"Authenticate with Daytona
Log in to your Daytona account using your API key:
daytona login --api-key=YOUR_API_KEYReplace YOUR_API_KEY with your actual Daytona API key.
Create a Sandbox
Create a new sandbox for running Claude Code:
daytona sandbox create --name claude-sandboxThis creates a sandbox named claude-sandbox, visible in your Dashboard. The default Daytona snapshot includes Claude Code, so the command above is all you need.
Connect to the Sandbox
SSH into your sandbox:
daytona ssh claude-sandboxYou now have an interactive terminal session inside the sandbox.
Run Claude Code
Inside the SSH session, start Claude Code:
claudeOn first run, Claude Code will prompt you to authenticate:
- Copy the authentication URL displayed in the terminal
- Open the URL in your local browser
- Complete the authentication flow
- Copy the code provided by the browser
- Paste the code back into the terminal
Once authenticated, you’re all set. Claude Code runs inside the sandbox while you control it from your terminal.