Docker Installation
Deploy OpenClaw with Docker containers
1Prerequisites
- Docker 20.10 or higher
- Docker Compose v2 (recommended)
- At least 4GB available RAM
2Quick Start
Pull and run with a single command:
terminal
docker run -d \
--name openclaw \
--restart unless-stopped \
-p 3000:3000 \
-v ~/.openclaw:/root/.openclaw \
-e ANTHROPIC_API_KEY="your-api-key" \
openclaw/openclaw:latest3Docker Compose (Recommended)
Create a docker-compose.yml file:
terminal
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./data:/root/.openclaw
environment:
- ANTHROPIC_API_KEY=your-api-key
- OPENAI_API_KEY=your-api-key # optional4Management Commands
Manage the service with Docker Compose:
terminal
# Start service
docker compose up -d
# View logs
docker compose logs -f openclaw
# Stop service
docker compose down
# Update to latest version
docker compose pull && docker compose up -dTips
- β’Use volumes to mount data directory for persistence
- β’Docker Compose makes management and updates easier
- β’Use Watchtower for automatic image updates
Warning
- β’Ensure mounted volume permissions are correct to avoid data loss
- β’Never put API keys in Dockerfile β use environment variables or .env files
Frequently Asked Questions
What is the recommended way to deploy OpenClaw with Docker?βΎ
Docker Compose is recommended. Create a docker-compose.yml with the OpenClaw image, port mappings, volumes for persistence, and environment variables for API keys.
How do I persist data when using Docker?βΎ
Mount a volume to /root/.openclaw in the container. With Docker Compose, use "volumes: - ./data:/root/.openclaw" to map a local directory.
How do I update OpenClaw in Docker?βΎ
Run "docker compose pull && docker compose up -d" to pull the latest image and recreate the container with zero downtime.