Skip to main content

Docker Setup

This guide covers running OpenClaw in Docker containers using the official Dockerfile and docker-compose configurations.

Overview

Docker deployment benefits:
  • Isolated runtime environment
  • Reproducible builds
  • Easy version management
  • Simplified updates
  • Cross-platform consistency

Prerequisites

  • Docker Engine 20.10+
  • Docker Compose 2.0+ (optional, for multi-container setup)
  • 2GB available disk space
  • Basic Docker knowledge

Quick Start

Build from Source

Using Docker Compose

The repository includes a production-ready docker-compose.yml:

Dockerfile Reference

The official Dockerfile includes:

Build Arguments

Build with browser pre-installed:

Docker Compose Configuration

From docker-compose.yml in the repository:

Service Breakdown

openclaw-gateway — Main gateway service:
  • Exposes ports 18789 (gateway) and 18790 (bridge)
  • Mounts config and workspace directories
  • Auto-restarts on failure
  • Uses --bind lan for container networking
openclaw-cli — Interactive CLI service:
  • Shares same volumes as gateway
  • For running interactive commands
  • Requires TTY allocation

Volume Mounting

Persistence requires proper volume mounts. Without volumes, all state is lost on container restart.

Critical Directories

Volume Examples

Bind mounts (development):
Named volumes (production):

Environment Variables

Required Variables

Optional Variables

Networking

Port Exposure

Gateway Bind Modes

For containerized deployments:
Default Dockerfile CMD binds to loopback for security. Override with --bind lan for container networking.

Running on Different Platforms

Synology NAS

OpenClaw works on Synology Docker:
  1. Build with ARM support if needed:
  2. Use Synology Docker UI:
    • Import image or build from Git
    • Create container with environment variables
    • Map volumes to NAS storage
    • Enable auto-restart
  3. Environment variable notes:
    • Force pnpm: OPENCLAW_PREFER_PNPM=1
    • Disable browser: Don’t set OPENCLAW_INSTALL_BROWSER

Raspberry Pi

For ARM devices:

Kubernetes

Example deployment:

Troubleshooting

Container Won’t Start

Permission Issues

The container runs as node user (UID 1000):

Network Issues

Browser Automation Fails

Rebuild with Chromium pre-installed:

Production Best Practices

1

Use named volumes

Avoid bind mounts in production for better portability
2

Set resource limits

3

Enable auto-restart

4

Use secrets for credentials

5

Monitor logs

Updating

Rebuild and Restart

With Docker Compose

Next Steps

Security Guide

Secure your Docker deployment

Deployment Options

Deploy to cloud platforms

Troubleshooting

Common Docker issues

Multi-Agent Setup

Run multiple isolated agents