Setting Up Your Development Environment

Docker Sandbox Setup

5 min read

Computer Use gives Claude control over your computer. For safety during development, we use Docker to create an isolated environment.

Why Docker?

Concern Docker Solution
Accidental file deletion Isolated filesystem
Unintended commands Contained execution
Network access Controlled networking
System changes Disposable containers

Using Anthropic's Quickstart

Anthropic provides a ready-to-use Docker setup:

# Clone the quickstart repository
git clone https://github.com/anthropics/claude-quickstarts.git
cd claude-quickstarts/computer-use-demo

# Build the container
docker build -t computer-use-demo .

# Run with your API key
docker run -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
    -p 5900:5900 -p 8501:8501 -p 6080:6080 \
    computer-use-demo

Container Ports

Port Service Access
5900 VNC View desktop via VNC client
6080 noVNC View desktop in browser
8501 Streamlit Demo web interface

Accessing the Desktop

Option 1: Browser (noVNC)

http://localhost:6080/vnc.html

Option 2: VNC Client

vnc://localhost:5900

Custom Dockerfile

For your own projects, start with this base:

FROM ubuntu:22.04

# Install desktop environment
RUN apt-get update && apt-get install -y \
    xvfb \
    x11vnc \
    fluxbox \
    firefox \
    python3 \
    python3-pip

# Set display
ENV DISPLAY=:99

# Install Anthropic SDK
RUN pip3 install anthropic

# Start virtual display
CMD Xvfb :99 -screen 0 1024x768x24 & \
    fluxbox & \
    x11vnc -display :99 -forever -shared

Resolution Configuration

Set screen resolution in Docker:

# 1024x768 - Fast, low cost
Xvfb :99 -screen 0 1024x768x24

# 1920x1080 - Full HD, more detail
Xvfb :99 -screen 0 1920x1080x24

Safety Note: Never run Computer Use agents with access to sensitive data, credentials, or production systems during development.

In the next lesson, we'll create your first Computer Use agent. :::

Quiz

Module 2: Development Environment

Take Quiz