Haven't installed OpenClaw yet?
curl -fsSL https://openclaw.ai/install.sh | bashiwr -useb https://openclaw.ai/install.ps1 | iexcurl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmdWorried it'll affect your machine? ClawTank — cloud deploy in 60s, zero risk to your files.
Docker is the most popular way to self-host OpenClaw. It gives you an isolated environment, easy updates, and consistent behavior across different servers. Here's how to set it up.
Prerequisites
- A server or VPS with 2+ vCPU and 4GB+ RAM
- Docker and Docker Compose installed
- An AI provider API key (Anthropic, OpenAI, or Google)
Step 1: Create a Docker Compose File
Create a docker-compose.yml:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3001:3001"
volumes:
- openclaw_data:/app/data
environment:
- ANTHROPIC_API_KEY=sk-ant-your-key-here
- OPENCLAW_GATEWAY_TOKEN=your-secure-token
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
openclaw_data:
Important: Set OPENCLAW_GATEWAY_TOKEN explicitly. Without it, OpenClaw regenerates the token on every restart, breaking your gateway connection.
Step 2: Start the Container
docker compose up -d
Watch the logs until you see [gateway] listening on:
docker compose logs -f openclaw
The gateway takes about 40 seconds to fully start. Don't worry about earlier messages like [entrypoint] Starting OpenClaw gateway — that's not the ready signal.
Step 3: Run the Setup Wizard
Connect to the container and run onboarding:
docker exec -it openclaw openclaw onboard
This walks you through:
