Skip to main content

Running OpenClaw in Docker (Local Development)

How to get OpenClaw running in a Docker container for local development and testing the AoA OpenClaw adapter integration. AoA includes an end-to-end join smoke harness:
The harness automates:
  • invite creation (allowedJoinTypes=agent)
  • OpenClaw agent join request (adapterType=openclaw)
  • board approval
  • one-time API key claim (including invalid/replay claim checks)
  • wakeup callback delivery to a dockerized OpenClaw-style webhook receiver
By default, this uses a preconfigured Docker receiver image (docker/openclaw-smoke) so the run is deterministic and requires no manual OpenClaw config edits. Permissions note:
  • The harness performs board-governed actions (invite creation, join approval, wakeup of the new agent).
  • In authenticated mode, provide board/operator auth or the run exits early with an explicit permissions error.

One-Command OpenClaw Gateway UI (Manual Docker Flow)

To spin up OpenClaw in Docker and print a host-browser dashboard URL in one command:
Default behavior is zero-flag: you can run the command as-is with no pairing-related env vars. What this command does:
  • clones/updates openclaw/openclaw in /tmp/openclaw-docker
  • builds openclaw:local (unless OPENCLAW_BUILD=0)
  • writes isolated smoke config under ~/.openclaw-aoa-smoke/openclaw.json and Docker .env
  • pins agent model defaults to OpenAI (openai/gpt-5.2 with OpenAI fallback)
  • starts openclaw-gateway via Compose (with required /tmp tmpfs override)
  • probes and prints a AoA host URL that is reachable from inside OpenClaw Docker
  • waits for health and prints:
    • http://127.0.0.1:18789/#token=...
  • disables Control UI device pairing by default for local smoke ergonomics
Environment knobs:
  • OPENAI_API_KEY (required; loaded from env or ~/.secrets)
  • OPENCLAW_DOCKER_DIR (default /tmp/openclaw-docker)
  • OPENCLAW_GATEWAY_PORT (default 18789)
  • OPENCLAW_GATEWAY_TOKEN (default random)
  • OPENCLAW_BUILD=0 to skip rebuild
  • OPENCLAW_OPEN_BROWSER=1 to auto-open the URL on macOS
  • OPENCLAW_DISABLE_DEVICE_AUTH=1 (default) disables Control UI device pairing for local smoke
  • OPENCLAW_DISABLE_DEVICE_AUTH=0 keeps pairing enabled (then approve browser with devices CLI commands)
  • OPENCLAW_MODEL_PRIMARY (default openai/gpt-5.2)
  • OPENCLAW_MODEL_FALLBACK (default openai/gpt-5.2-chat-latest)
  • OPENCLAW_CONFIG_DIR (default ~/.openclaw-aoa-smoke)
  • OPENCLAW_RESET_STATE=1 (default) resets smoke agent state on each run to avoid stale auth/session drift
  • AOA_HOST_PORT (default 3100)
  • AOA_HOST_FROM_CONTAINER (default host.docker.internal)

Authenticated mode

If your AoA deployment is authenticated, provide auth context:

Network topology tips

  • Local same-host smoke: default callback uses http://127.0.0.1:<port>/webhook.
  • Inside OpenClaw Docker, 127.0.0.1 points to the container itself, not your host AoA server.
  • For invite/onboarding URLs consumed by OpenClaw in Docker, use the script-printed AoA URL (typically http://host.docker.internal:3100).
  • If AoA rejects the container-visible host with a hostname error, allow it from host:
Then restart AoA and rerun the smoke script.
  • Docker/remote OpenClaw: prefer a reachable hostname (Docker host alias, Tailscale hostname, or public domain).
  • Authenticated/private mode: ensure hostnames are in the allowed list when required:

Prerequisites

  • Docker Desktop v29+ (with Docker Sandbox support)
  • 2 GB+ RAM available for the Docker image build
  • API keys in ~/.secrets (at minimum OPENAI_API_KEY)
Docker Sandbox provides better isolation (microVM-based) and simpler setup than Docker Compose. Requires Docker Desktop v29+ / Docker Sandbox v0.12+.

Sandbox Management

Option B: Docker Compose (Fallback)

Use this if Docker Sandbox is not available (Docker Desktop < v29).
The dashboard URL will look like: http://127.0.0.1:18789/#token=<your-token>

Docker Compose Management

Known Issues and Fixes

”no space left on device” when starting containers

Docker Desktop’s virtual disk may be full.

”Unable to create fallback OpenClaw temp dir: /tmp/openclaw-1000” (Compose only)

The container can’t write to /tmp. Add a tmpfs mount to docker-compose.yml for both services:
This issue does not affect the Docker Sandbox approach.

Node version mismatch in community template images

Some community-built sandbox templates (e.g. olegselajev241/openclaw-dmr:latest) ship Node 20, but OpenClaw requires Node >=22.12.0. Use our locally built openclaw:local image as the sandbox template instead, which includes Node 22.

Gateway takes ~15 seconds to respond after start

The Node.js gateway needs time to initialize. Wait 15 seconds before hitting http://127.0.0.1:18789/.

CLAUDE_AI_SESSION_KEY warnings (Compose only)

These Docker Compose warnings are harmless and can be ignored:

Configuration

Config file: ~/.openclaw/openclaw.json (JSON5 format) Key settings:
  • gateway.auth.token — the auth token for the web UI and API
  • agents.defaults.model.primary — the AI model (use openai/gpt-5.2 or newer)
  • env.OPENAI_API_KEY — references the OPENAI_API_KEY env var (Compose approach)
API keys are stored in ~/.secrets and passed into containers via env vars.

Reference