Install OpenClaw on Docker
Deploy OpenClaw on servers, NAS, or homelab using Docker. Isolated environment with persistent storage and easy updates.
Recommended for users who want 24/7 uptime and have a server or NAS available.
Prerequisites
- Docker version 20.10 or later
- Docker Compose v2 (recommended) or use
docker-composecommand - AI Provider API Key (Anthropic Claude, OpenAI, Google Gemini, etc.)
- Ports: 3000 (or your preferred port)
Quick Start
Create a directory for your OpenClaw deployment and save this as docker-compose.yml:
version: "3.9"
services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3000:3000"
environment:
# Required: At least one AI provider
ANTHROPIC_API_KEY: your_claude_api_key
# Optional: Add more providers as needed
# OPENAI_API_KEY: your_openai_key
# GOOGLE_GENERATIVE_AI_API_KEY: your_google_key
# XAI_API_KEY: your_xai_key
volumes:
- ./openclaw_data:/var/lib/openclaw
Start the container:
docker compose up -d
Check the logs:
docker logs -f openclaw
Environment Variables
OpenClaw supports multiple AI providers. Configure at least one:
ANTHROPIC_API_KEY |
Claude API key (recommended) |
OPENAI_API_KEY |
OpenAI API key |
GOOGLE_GENERATIVE_AI_API_KEY |
Google Gemini API key |
XAI_API_KEY |
xAI API key |
DEFAULT_MODEL |
Default model to use (e.g., claude-sonnet-4-20250514) |
Volumes & Persistence
The ./openclaw_data volume stores:
- Configuration: API keys, settings
- Memory: Long-term memory and conversation history
- Logs: Application logs
Back up this directory regularly to preserve your data and memory.
Production Configuration
For production deployments, add health checks, resource limits, and security options:
version: "3.9"
services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3000:3000"
environment:
ANTHROPIC_API_KEY: your_claude_api_key
volumes:
- ./openclaw_data:/var/lib/openclaw
# Production settings
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
Docker Run (Alternative)
Prefer using Docker directly without Compose?
# Create volume for persistence
docker volume create openclaw_data
# Run the container
docker run -d \
--name openclaw \
-p 3000:3000 \
-v openclaw_data:/var/lib/openclaw \
-e ANTHROPIC_API_KEY=your_claude_api_key \
--restart unless-stopped \
ghcr.io/openclaw/openclaw:latest
Common Commands
docker compose down
docker compose restart
docker compose pull && docker compose up -d
docker logs --tail 100 -f openclaw
Reverse Proxy & HTTPS
To access OpenClaw over the internet with HTTPS, use a reverse proxy:
- Nginx - Popular web server and reverse proxy
- Caddy - Automatic HTTPS
- Traefik - Container-native reverse proxy
- Cloudflare Tunnel - See our Cloudflare guide
Never expose OpenClaw directly to the internet without HTTPS and authentication.
Troubleshooting
- Container won't start? Check logs:
docker logs openclaw - API key errors? Verify your environment variable is set correctly
- Port already in use? Change the port mapping (e.g.,
"8080:3000") - Out of memory? Increase Docker memory allocation or add swap
More troubleshooting tips on the Troubleshoot page.
For the latest Docker images and updates, check the GitHub Container Registry.