Deploy OpenClaw with Docker

Compose, security, and upgrades—done right

OpenClaw Docker Deploy Feature

Dockerizing OpenClaw makes the runtime predictable: same environment, easy upgrades, safer defaults. The trick is to treat it like production—compose your services, keep secrets out of images, and avoid exposing the gateway broadly.

Why Docker for OpenClaw

Compose Anatomy (Minimal)

A minimal compose file that mounts your OpenClaw workspace, binds the local dashboard, and defines healthchecks:

services:
  openclaw-gateway:
    image: openclaw/gateway:latest
    container_name: openclaw-gateway
    restart: unless-stopped
    ports:
      - "127.0.0.1:18789:18789"
    volumes:
      - ~/.openclaw:/home/openclaw/.openclaw
    environment:
      - NODE_ENV=production
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:18789/health"]
      interval: 15s
      timeout: 3s
      retries: 6

Bind to loopback to avoid public exposure; use a VPN/tunnel when remote access is required.

Volumes and Secrets

Do not bake credentials into images. Mount a dedicated workspace and use secret files:

# Example secret mount (adjust paths)
volumes:
  - ~/.openclaw:/home/openclaw/.openclaw
# Keep provider API keys in files under the workspace
# Rotate tokens after upgrades or suspicious activity

Safe Networking Patterns

Loopback First

Expose the dashboard on 127.0.0.1. Use SSH tunnels, Tailscale, or reverse proxies when accessing remotely.

Approvals On

Keep approvals enabled for privileged actions. Containerize tool execution by default.

Strict Access

Use separate browser profiles, avoid visiting unknown pages while logged into the Control UI, and rotate tokens routinely.

Logs, Upgrades, and Health

# Follow logs
docker compose logs -f openclaw-gateway

# Upgrade image
docker compose pull openclaw-gateway
docker compose up -d

# Check status
docker compose ps

After upgrades, verify version in the dashboard and test a known safe workflow.

WSL2 and Windows Notes

Security Checklist

Ship a Dockerized Skill This Week

Start with one workflow, keep secrets out of images, and iterate with logs and health checks.