Reference Documentation: For comprehensive Docker configuration, advanced settings, troubleshooting, and all deployment options, see the Docker Deployment Reference Guide. This tutorial provides a hands-on, step-by-step workflow to get you deployed quickly. The reference guide contains all the detailed configuration options.

Choosing a Deployment Method

OpenClaw can be deployed in several ways:

  • Docker (Recommended) - Containerized deployment with isolation and easy management
  • Serverless (Moltworker) - Run on Cloudflare Workers without hardware (see Moltworker Guide)
  • Direct Installation - Install directly on your server (see Installation Guide)

This tutorial focuses on Docker deployment, which is the most common production deployment method. For other options, see the links above.

Prerequisites

Before starting, ensure you have:

  • Docker installed - Version 20.10 or later
  • Docker Compose - Version 2.0 or later (optional but recommended)
  • Server access - SSH access to your deployment server
  • Basic Docker knowledge - Understanding of containers and volumes
  • OpenClaw configured - Have completed initial setup (see Getting Started Tutorial)

Step 1: Install Docker

First, install Docker on your server. The method depends on your operating system:

Linux (Ubuntu/Debian)

Install Docker
# Update package index
sudo apt-get update

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Add your user to docker group
sudo usermod -aG docker $USER

# Install Docker Compose
sudo apt-get install docker-compose-plugin

# Verify installation
docker --version
docker compose version

macOS

Install Docker Desktop
# Download and install Docker Desktop for Mac
# Visit: https://www.docker.com/products/docker-desktop

# Or use Homebrew
brew install --cask docker

# Start Docker Desktop
open -a Docker

Verify Installation

Test Docker
# Test Docker installation
docker run hello-world

# Check Docker Compose
docker compose version

Step 2: Create Docker Compose File

Create a docker-compose.yml file in your project directory:

docker-compose.yml
version: '3.8'

services:
  openclaw:
    image: openclaw/openclaw:latest
    container_name: openclaw
    restart: unless-stopped
    ports:
      - "18789:18789"  # Gateway WebSocket
      - "18793:18793"  # Canvas host
    volumes:
      - ~/.clawdbot:/root/.clawdbot  # Configuration
      - ~/clawd:/root/clawd          # Workspace
    environment:
      - NODE_ENV=production
    command: openclaw gateway

Key Configuration Points:

  • Ports: 18789 (Gateway) and 18793 (Canvas) are exposed
  • Volumes: Configuration and workspace are persisted to host
  • Restart Policy: Container restarts automatically unless stopped manually
  • Command: Runs the Gateway service

For advanced configuration options (network settings, resource limits, environment variables, sandboxing), see the Docker Deployment Reference Guide.

Step 3: Configure Volume Paths

Ensure the volume paths exist on your host system:

Create Directories
# Create configuration directory
mkdir -p ~/.clawdbot

# Create workspace directory
mkdir -p ~/clawd

# Set proper permissions
chmod 755 ~/.clawdbot
chmod 755 ~/clawd

Important: If you already have OpenClaw configured locally, these directories should already exist with your configuration and workspace data.

Step 4: Start the Container

Start OpenClaw using Docker Compose:

Start Container
# Start in detached mode
docker compose up -d

# View logs
docker compose logs -f

# Check container status
docker compose ps

Expected Output: You should see the Gateway starting and listening on port 18789.

Step 5: Verify Deployment

Verify that OpenClaw is running correctly:

Check Container Status

Check Status
# Check if container is running
docker ps | grep openclaw

# Check container logs
docker compose logs openclaw

# Execute commands inside container
docker compose exec openclaw openclaw status

Access Control UI

Open your browser and navigate to:

Control UI URL
http://localhost:18789

If you're deploying on a remote server, replace localhost with your server's IP address or domain name.

Step 6: Configure for Production

For production deployments, you'll want to add resource limits and security configurations. Here's a production-ready example:

Production docker-compose.yml
version: '3.8'

services:
  openclaw:
    image: openclaw/openclaw:latest
    container_name: openclaw
    restart: unless-stopped
    ports:
      - "18789:18789"
      - "18793:18793"
    volumes:
      - ~/.clawdbot:/root/.clawdbot
      - ~/clawd:/root/clawd
    environment:
      - NODE_ENV=production
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 2G
        reservations:
          cpus: '1'
          memory: 1G
    command: openclaw gateway

Production Checklist:

  • ✅ Resource limits configured (prevents resource exhaustion)
  • ✅ Volumes mounted (data persistence)
  • ✅ Restart policy set (auto-recovery)
  • ✅ Environment variables set for production

Additional Production Considerations:

  • Use a reverse proxy (nginx, Traefik) for HTTPS - See Docker Reference for details
  • Configure firewall rules to restrict port access
  • Regular backups of ~/.clawdbot and ~/clawd directories
  • Monitor logs for security issues

For comprehensive production configuration, advanced network settings, sandboxing options, and detailed security practices, see the Docker Deployment Reference Guide and our Security Guide.

Step 7: Managing the Container

Here are the essential commands for managing your OpenClaw container:

Essential Commands

Container Management
# Start container
docker compose up -d

# Stop container
docker compose stop

# Restart container
docker compose restart

# View logs
docker compose logs -f

# Update to latest version
docker compose pull
docker compose up -d

For complete container management commands, including executing commands inside the container, troubleshooting, and advanced operations, see the Docker Deployment Reference Guide.

Troubleshooting

If you encounter issues, here are quick fixes for common problems:

Container Won't Start

  • Check Docker logs: docker compose logs openclaw
  • Verify port availability: netstat -tuln | grep 18789
  • Check volume permissions: ls -la ~/.clawdbot
  • Verify Docker is running: docker ps

Can't Access Control UI

  • Check if container is running: docker ps | grep openclaw
  • Verify port mapping: docker compose ps
  • Check firewall rules on the server
  • Try accessing from server itself: curl http://localhost:18789

For comprehensive troubleshooting, including permission issues, port conflicts, data persistence problems, and Docker-specific solutions, see the Docker Deployment Reference Guide and our Troubleshooting Guide.

Next Steps

Now that you've deployed OpenClaw with Docker:

📚 Reference Documentation

This tutorial covered the essential workflow to get you deployed. For comprehensive Docker configuration details, advanced settings, network configuration, environment variables, sandboxing, resource limits, and complete troubleshooting, see the Docker Deployment Reference Guide.