🦞OpenClaw Guide
🐳 Docker Guide

OpenClaw + Docker

Run OpenClaw in a container. Portable, reproducible, and easy to deploy anywhere.

Quick Start

# Pull and run
docker run -d \
  --name openclaw \
  -v ~/.openclaw:/root/.openclaw \
  -e ANTHROPIC_API_KEY=your-key-here \
  --restart unless-stopped \
  openclaw/openclaw:latest

That's it! OpenClaw is now running in a container.

Docker Compose (Recommended)

docker-compose.yml
version: '3.8'

services:
  openclaw:
    image: openclaw/openclaw:latest
    container_name: openclaw
    restart: unless-stopped
    
    # Mount your config and workspace
    volumes:
      - ./config:/root/.openclaw
      - ./workspace:/root/workspace
    
    # API keys (use .env file)
    environment:
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - TZ=America/New_York  # Your timezone
    
    # Optional: expose web UI
    ports:
      - "3000:3000"
    
    # Health check
    healthcheck:
      test: ["CMD", "openclaw", "status"]
      interval: 30s
      timeout: 10s
      retries: 3

.env file

# .env
ANTHROPIC_API_KEY=sk-ant-xxxxx
OPENAI_API_KEY=sk-xxxxx

Run it

# Start in background
docker-compose up -d

# View logs
docker-compose logs -f

# Stop
docker-compose down

Configuration

config/openclaw.yaml
Mount this file to /root/.openclaw/openclaw.yaml
# AI Provider
ai:
  provider: anthropic
  model: claude-sonnet-4-20250514
  # API key comes from environment variable

# Telegram (recommended for Docker)
channels:
  telegram:
    enabled: true
    token: "YOUR_TELEGRAM_BOT_TOKEN"
    allowedUsers:
      - "YOUR_TELEGRAM_ID"

# Workspace inside container
workspace: /root/workspace

# Logging
logging:
  level: info
  file: /root/.openclaw/logs/openclaw.log

Environment Variables

VariableDescriptionRequired
ANTHROPIC_API_KEYClaude API keyYes*
OPENAI_API_KEYOpenAI API keyYes*
TELEGRAM_BOT_TOKENTelegram bot tokenNo
OPENCLAW_CONFIGPath to config fileNo
TZTimezone (e.g., America/New_York)No
LOG_LEVELdebug, info, warn, errorNo

* At least one AI provider key is required.

Volumes & Persistence

/root/.openclaw

Config files, memory, and state. Mount this to persist across restarts.

/root/workspace

Working directory for files, projects, and skills.

volumes:
  - ./openclaw-data:/root/.openclaw  # Persist config & memory
  - ./workspace:/root/workspace       # Persist workspace files

Updating

# Pull latest image
docker-compose pull

# Recreate container with new image
docker-compose up -d

# Or one-liner:
docker-compose pull && docker-compose up -d

Troubleshooting

Container keeps restarting

Check logs: docker-compose logs openclaw. Usually a config or API key issue.

Can't connect to Telegram

Ensure the container has network access. Check if token is correct.

Files not persisting

Make sure volumes are mounted correctly. Check permissions on host directories.

Out of memory

Add memory limits: deploy: resources: limits: memory: 2G

Building Custom Image

Custom Dockerfile
Add your own skills and customizations
FROM openclaw/openclaw:latest

# Add custom skills
COPY ./my-skills /root/.openclaw/skills/

# Pre-install dependencies
RUN openclaw skill install my-custom-skill

# Custom entrypoint
CMD ["openclaw", "start"]

Skip Docker Complexity?

Get a Mac Mini with OpenClaw pre-installed. No Docker, no containers — just native macOS. Use code OPENCLAW15 for 15% off.