Cross-platform universal method for most users. Pull image with one command, manage with docker-compose, deploy in 10 minutes.
Docker is the simplest and most recommended way to deploy OpenClaw. No need to manually install Node.js or any dependencies — one command to start. Works on Mac, Windows, and Linux. The environment is fully isolated, making upgrades and backups effortless. For beginners, Docker avoids many pitfalls of source code installation.
Open your terminal (Mac/Linux) or PowerShell (Windows) and pull the latest OpenClaw Docker image:
docker pull openclaw/openclaw:latest
Create a new directory to hold OpenClaw configuration files:
mkdir openclaw && cd openclaw
Create a docker-compose.yml file in that directory with the following content:
version: "3.8"
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3210:3210"
volumes:
- openclaw_data:/app/data
env_file:
- .env
environment:
- NODE_ENV=production
volumes:
openclaw_data:Create a .env file in the same directory with your API keys and runtime configuration. This is the most critical configuration step:
# OpenClaw 环境变量配置 # 大模型 API 密钥(必填,至少配置一个) # Option 1: OpenAI / GPT OPENAI_API_KEY=sk-your-openai-api-key OPENAI_MODEL=gpt-4o # Option 2: Claude # ANTHROPIC_API_KEY=sk-ant-your-key # ANTHROPIC_MODEL=claude-sonnet-4-20250514 # Option 3: DeepSeek(国产,性价比高) # DEEPSEEK_API_KEY=your-deepseek-key # DEEPSEEK_MODEL=deepseek-chat # 访问密码(强烈建议设置) ACCESS_CODE=your-secure-password # 端口(默认 3210) PORT=3210
Start OpenClaw with a single command (-d for background mode):
docker compose up -d
On first run, the image will be pulled automatically if not done earlier. Check status and logs with:
# 查看容器状态 docker compose ps # 查看实时日志 docker compose logs -f openclaw
Open your browser and navigate to:
http://localhost:3210
# 停止 OpenClaw docker compose stop # 重新启动 docker compose restart # 更新到最新版本 docker compose pull && docker compose up -d # 查看日志 docker compose logs -f openclaw # 完全删除(数据保留在 volume 中) docker compose down
Change the port mapping in docker-compose.yml from "3210:3210" to "3211:3210", then access via http://localhost:3211.
Run docker compose logs openclaw to check error logs. Common causes: malformed .env file (no spaces around =), invalid API key, insufficient memory (2GB minimum).
Network issues in certain regions. Configure Docker mirror accelerators via Docker Desktop → Settings → Docker Engine.
Run docker compose pull && docker compose up -d. Data persists via Docker volumes — nothing is lost during updates.
Data is in Docker volume openclaw_data. Export with: docker run --rm -v openclaw_data:/data -v $(pwd):/backup busybox tar czf /backup/openclaw-backup.tar.gz /data
Your agent is installed but can't think or talk yet — configure an LLM API and messaging tool to bring it alive.
Feed Your Agent