How to Run OpenClaw with Docker
The fastest official Docker path is from the OpenClaw repo root with `./docker-setup.sh`, then a dashboard open, token paste, and container health check.
How to run OpenClaw with Docker
The official Docker guide treats Docker as optional, not the default install path. If you want a containerized gateway, the recommended flow is from the OpenClaw repo root with ./docker-setup.sh, then a dashboard check and container probe.
Who this is for
- You want a throwaway or isolated gateway environment.
- You prefer Docker Compose over a direct local install.
- You want the official scripted flow instead of writing your own compose stack.
What you need before you start
- Docker Desktop or Docker Engine with Compose v2.
- Enough disk space for image layers and logs.
- Git so you can clone the OpenClaw repo.
Step-by-step setup
Step 1: Clone the official repository
| git clone https://github.com/openclaw/openclaw.git |
| cd openclaw |
Expected result: you are in the repo root where docker-setup.sh exists.
Step 2: Run the official Docker setup script
| ./docker-setup.sh |
The official Docker docs say this script builds the gateway image, runs onboarding, starts the gateway with Docker Compose, generates a gateway token, and writes it into .env.
Step 3: Open the dashboard
Open the local Control UI:
| http://127.0.0.1:18789/ |
Then paste the token into the Control UI settings if prompted.
Step 4: Reprint a fresh dashboard link when needed
| docker compose run --rm openclaw-cli dashboard --no-open |
Expected result: the CLI prints the current dashboard URL again without needing to rerun the full setup.
Step 5: Check the running containers
| docker compose ps |
Expected result: the gateway container shows as running.
Verify it worked
docker compose psshows the gateway container as up.- The dashboard loads at
http://127.0.0.1:18789/. - The generated config and workspace appear on the host under
~/.openclaw/and~/.openclaw/workspace.
Common problems and fixes
The dashboard says unauthorized or pairing required
Fetch a fresh dashboard link and approve the device from the CLI container:
| docker compose run --rm openclaw-cli dashboard --no-open |
| docker compose run --rm openclaw-cli devices list |
| docker compose run --rm openclaw-cli devices approve --latest |
I need extra host mounts
Set the extra mounts variable before you rerun the setup script:
| export OPENCLAW_EXTRA_MOUNTS="$HOME/.codex:/home/node/.codex:ro,$HOME/github:/home/node/github:rw" |
| ./docker-setup.sh |
I need a persistent /home/node
Use the official volume knob and rerun the setup:
| export OPENCLAW_HOME_VOLUME="openclaw_home" |
| ./docker-setup.sh |
FAQ
Do I need Docker for sandboxed tools?
Not necessarily. The Docker guide explicitly says agent sandboxing uses Docker too, but sandboxing does not require the entire gateway to run in Docker.
Can I do the setup manually without docker-setup.sh?
Yes. The docs include a manual compose flow, but the scripted path is the recommended quick start for a containerized gateway.
Where does Docker OpenClaw store config and workspace data?
On the host, under ~/.openclaw/ and ~/.openclaw/workspace, even when the gateway itself runs in containers.
Official sources
Related OpenClaw guides
Follow the next most relevant setup guide without leaving the cluster.
Use the official OpenClaw Ansible installer for a production-style VPS deployment, then verify the gateway and keep the Control UI off the public internet.
Finish the OpenClaw onboarding wizard, configure the gateway, open the dashboard, and approve first device access when needed.
Turn on OpenClaw heartbeats, keep them quiet outside active hours, and verify they run without spamming you.