Deployment & Hosting
🐳
Docker Deployment for OpenClaw
Run OpenClaw in a Docker container for portable, reproducible deployments.
5 分钟阅读|
dockercontainerdockerfile
Why Docker?
Docker packages OpenClaw and its dependencies into a portable container. Benefits:
- Consistent environment across machines
- Easy deployment and updates
- Isolation from host system
- Simple rollbacks
Quick Start
Using Docker Compose
Create docker-compose.yml:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: always
volumes:
- ./openclaw-data:/root/.openclaw
environment:
- OPENROUTER_API_KEY=sk-or-...
- TELEGRAM_BOT_TOKEN=...
ports:
- "3000:3000"
Run:
docker compose up -d
Using Docker Run
docker run -d \
--name openclaw \
--restart always \
-v $(pwd)/openclaw-data:/root/.openclaw \
-e OPENROUTER_API_KEY=sk-or-... \
-e TELEGRAM_BOT_TOKEN=... \
openclaw/openclaw:latest
Custom Dockerfile
If you need customization:
FROM node:20-slim
RUN npm install -g openclaw
WORKDIR /root/.openclaw
COPY openclaw.json .
COPY skills/ ./skills/
CMD ["openclaw", "start"]
Build and run:
docker build -t my-openclaw .
docker run -d --name openclaw --restart always my-openclaw
Data Persistence
Mount a volume for persistent data:
/root/.openclaw— Configuration, memory, history, skills
Without a volume mount, data is lost when the container restarts.
Updating
docker compose pull
docker compose up -d
Or for docker run:
docker pull openclaw/openclaw:latest
docker stop openclaw && docker rm openclaw
# Re-run the docker run command
Monitoring
docker logs -f openclaw # View logs
docker stats openclaw # Resource usage
docker exec -it openclaw sh # Shell into container
Tips
- Use
.envfiles for secrets instead of inline environment variables - Pin to specific version tags for production stability
- Set memory limits to prevent runaway usage
- Use Docker health checks for automatic restart on failure
dockercontainerdockerfiledocker composecontainerized
相关指南
☁️6 分钟
Deploying OpenClaw to the Cloud
Overview of cloud deployment options for OpenClaw — GCP, AWS, DigitalOcean, and managed services.
🚀4 分钟
Claw for All Quick Start: OpenClaw Without the Terminal
Get started with Claw for All in minutes — sign up, subscribe, and deploy your AI assistant.
🌐6 分钟
Running OpenClaw on a Google Cloud VM
Deploy OpenClaw on Google Compute Engine with automated provisioning and management.