DeploymentDocker Compose

OpenClaw Docker Compose Guide

A practical setup for VPS and local servers with clean env management and fast recovery.

When to use this deployment

  • You want stable 24/7 operation on a VPS
  • You need reproducible setup for multiple environments
  • You prefer easy rollback and versioned configuration

1) Create project directory

Terminal
mkdir -p ~/openclaw && cd ~/openclaw

2) Prepare .env file

Keep secrets out of compose.yml and store them in .env.

.env
OPENCLAW_MODEL_PROVIDER=openai
OPENCLAW_MODEL=gpt-5.3-codex
OPENCLAW_API_KEY=your_api_key_here
OPENCLAW_TIMEZONE=Asia/Shanghai
OPENCLAW_WEB_PORT=3000

3) Minimal docker-compose.yml

docker-compose.yml
services:
  openclaw:
    image: ghcr.io/openclaw/openclaw:latest
    container_name: openclaw
    restart: unless-stopped
    env_file:
      - .env
    ports:
      - "3000:3000"
    volumes:
      - ./data:/app/data
      - ./logs:/app/logs
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000"]
      interval: 30s
      timeout: 5s
      retries: 5

4) Start and verify

Terminal
docker compose pull
docker compose up -d
docker compose ps
docker compose logs -f --tail=200

If the Web UI is not reachable, first check VPS firewall/security group for TCP 3000.

5) Daily operations

  • Update image: docker compose pull && docker compose up -d
  • Backup: snapshot ./data and .env
  • Rollback: pin image tag instead of latest

SEO note for this tutorial page

This page targets query intent around "openclaw docker compose","openclaw vps deployment", and related setup phrases.

Quick Checklist

Compose file created and validated

Environment variables isolated in .env

Health check and logs verified after startup

Related Tutorials