Guide · OpenClaw Docker
OpenClaw Docker: Run Your Agent in a Container
How to run OpenClaw in Docker: which official image to use, the setup script, where your agent's data lives, keeping the dashboard private on a VPS, and updating without losing memory.
Last reviewed
OpenClaw publishes official Docker images and a setup script that does most of the work: it builds or pulls the image, runs onboarding, writes a Gateway token and starts everything with Docker Compose. Your agent then runs in a container that restarts on its own, with its memory and settings kept in folders on the host.
Docker is optional. OpenClaw's own docs say to use it when you want an isolated, throwaway Gateway or a host without local installs; if you already work on the machine, the normal installer is simpler. If you have decided on Docker, this guide covers the image to pick, the setup, where your data lives, how to keep the dashboard off the internet, and how to update without losing anything.
Ways to run OpenClaw in Docker
| Option | Best for | You look after | Cost |
|---|---|---|---|
| Docker Desktop on your own computer | Trying OpenClaw in an isolated, throwaway setup before you commit | The agent stops whenever the computer sleeps or Docker quits | Your own machine; check Docker Desktop's licence terms on docker.com |
| Pre-built image on a Linux VPS | An always-on Gateway on a small server, without building anything | Firewall, SSH tunnel, image upgrades, backups of three state folders | Monthly server rent, on the provider's pricing page |
| Image built from source | Choosing exactly which plugins go into the image | At least 6 GB RAM for the build, and a rebuild for every release | A larger server than the pre-built image needs |
| Browser image (a -browser tag) | Agents that browse websites from the Gateway itself | A bigger image, and mounts that can hide the bundled Chromium | Same server; allow more disk for the image |
Before you start
You need:
- Docker with Compose v2. Docker Desktop on a Mac or Windows machine, or Docker Engine on Linux. Check with
docker --versionanddocker compose version. - The OpenClaw repository. The setup script and
docker-compose.ymllive in it, so clone it even if you use a pre-built image:git clone https://github.com/openclaw/openclaw.git. - Enough memory for the route you pick. Building the image from source needs at least 6 GB of RAM. A pre-built image skips the build, so a smaller server works.
- Your model provider key, which onboarding asks for.
Pick an image
OpenClaw publishes its images first to the GitHub Container Registry as ghcr.io/openclaw/openclaw, with a mirror on Docker Hub as openclaw/openclaw. Use one of those two and avoid unofficial mirrors, which don't follow OpenClaw's release timing.
latestfollows stable releases. For a setup you want to stay put, use a version tag (releases are tagged by date, such as2026.9.3) and move it on purpose.extended-stablemoves only with the trailing-month Gateway releases, for slower, steadier updates.-slimvariants are smaller.-browservariants (such aslatest-browser) include Chromium, so the agent can drive a browser from inside the container. Without one, browser control from a Docker Gateway has nothing to launch.
The default images already include the codex and diagnostics-otel plugins. Claude Code is not in the image: to use it as a backend, you install and log in to it inside the container and keep the container's home folder on a volume (OpenClaw's Docker networking page has the steps).
Set it up
From the repository folder, choose the image and run the setup script:
cd openclaw
export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest"
./scripts/docker/setup.sh
Leave out the export line to build the image from source instead (it is tagged openclaw:local). The script then:
- asks for your model provider keys,
- generates a Gateway token and writes it to
.env, - starts the Gateway with Docker Compose.
Open http://127.0.0.1:18789/ and paste the token from .env into Settings. To print the dashboard link again, run docker compose run --rm openclaw-cli dashboard --no-open.
Add channels the same way, through the CLI container:
docker compose run --rm openclaw-cli channels login # WhatsApp (scan the QR code)
docker compose run --rm openclaw-cli channels add --channel telegram --token "<token>"
The script rewrites .env from your current shell every time it runs. To change one setting later, edit .env and recreate the container rather than running the script again from an empty shell.
Where your agent's data lives
The container itself is disposable. Everything that makes your agent yours is in three folders on the host, mounted into the container:
| Host folder (default) | What's in it |
|---|---|
~/.openclaw |
openclaw.json settings, the SQLite databases with sessions and credentials, .env secrets |
~/.openclaw/workspace |
Your agent's workspace files |
~/.openclaw-auth-profile-secrets |
A key used to recover older encrypted credentials |
Set OPENCLAW_CONFIG_DIR, OPENCLAW_WORKSPACE_DIR and OPENCLAW_AUTH_PROFILE_SECRET_DIR before running setup if you want them on a separate data disk. Three rules from OpenClaw's docs:
- Back up all three folders. Together they are your agent's memory and settings.
- Treat the backups as passwords. OAuth tokens (access, refresh and ID tokens) sit in plain text in the SQLite databases under the config folder.
- Keep them on a local disk. Don't put them on a NAS share over NFS, SMB or CIFS: SQLite needs locking those can't give it, and the databases can be corrupted.
Keep the dashboard private on a VPS
On a server, the defaults need one deliberate step. The Compose file publishes the Gateway's port, 18789, on the host, and Docker's published ports go through Docker's own firewall rules, so a host firewall such as ufw does not block them by itself. The Gateway still asks for its token, but it shouldn't be reachable from the internet at all.
- Let only SSH in at the provider's firewall. OpenClaw's Hetzner guide allows TCP 22 from your own network and adds no public rule for 18789.
- Reach the dashboard through an SSH tunnel. From your laptop:
ssh -N -L 18789:127.0.0.1:18789 user@your-server, then openhttp://127.0.0.1:18789/locally. - If you rely on ufw, add the
DOCKER-USERrules from OpenClaw's network-exposure page, which drop new outside connections to published container ports. Do the same for IPv6 if Docker has it on. - Prefer Tailscale Serve or a reverse proxy over opening the port, if you need the dashboard from more places. Follow OpenClaw's Gateway security page for either.
Keep it running
OpenClaw's Compose file sets the Gateway to restart: unless-stopped, so it comes back after a crash or a reboot, as long as Docker itself starts at boot. The image also has a built-in health check. To see how it is doing:
docker compose ps
docker compose logs -f openclaw-gateway
curl -fsS http://127.0.0.1:18789/healthz
/healthz says the Gateway process is up; /readyz also checks that its channels are working. A green /healthz with an agent that doesn't answer usually means a channel needs attention: see scheduled health checks for always-on personal agents for checking from outside, too.
Update without losing anything
Running openclaw update inside the container doesn't update it: the image owns the installation. Pull the new image and recreate the container instead:
docker compose pull openclaw-gateway openclaw-cli
docker compose stop openclaw-gateway
docker compose up -d openclaw-gateway
- Back up the three folders first. On start, the new image runs OpenClaw's
doctorrepair against your existing state and migrates its databases, keeping copies; a rollback means restoring the matching state as well as the old image. - Stop the old container before starting the new one, and only ever run one Gateway per state folder. Two Gateways on the same state block each other's repair.
- Use the same Compose files every time. If setup wrote a
docker-compose.extra.yml, include it with-fon every command, or its mounts drop out.
Common problems
EACCESor permission errors on/home/node/.openclaw. The image runs as usernode, uid 1000. Make the host folders belong to it:sudo chown -R 1000:1000on the config and workspace folders.- The build ends with
Killedor exit code 137. The server ran out of memory during a source build. Use a pre-built image, or a server with at least 6 GB of RAM. - The agent can't reach Ollama or LM Studio on the same machine. Inside the container,
127.0.0.1is the container. Usehttp://host.docker.internal:11434(Ollama) or:1234(LM Studio), and have those listen on0.0.0.0. - The dashboard says "unauthorized" or asks for pairing. Paste the token from
.env, or approve the browser withdocker compose run --rm openclaw-cli devices listanddevices approve <requestId>. - Browser tools fail on a
-browserimage. An existing home volume can hide the image's bundled Chromium; check your mounts.
When Docker is more than you need
Docker makes OpenClaw easy to replace and roll back, but you still own the server, the firewall, the backups and every upgrade. If that is more than you want to look after, compare the other ways to host it in our OpenClaw hosting guide, including managed hosting where someone else runs the Gateway, and see managed hosting vs self-hosting on a VPS.
Questions people ask
Is there an official OpenClaw Docker image?
Yes. OpenClaw publishes it to the GitHub Container Registry as ghcr.io/openclaw/openclaw, its primary registry, and mirrors it on Docker Hub as openclaw/openclaw. OpenClaw's docs advise against unofficial mirrors.
Do I need Docker to run OpenClaw?
No. OpenClaw's docs call Docker optional. The normal installer runs OpenClaw directly on a Mac, Linux machine or VPS; Docker is for an isolated, replaceable Gateway or a host where you don't want to install Node.
How much RAM does OpenClaw need in Docker?
Building the image from source needs at least 6 GB of RAM. The pre-built images skip that build, so a smaller server works. OpenClaw doesn't publish a fixed minimum for running the Gateway, so size up if you add a browser image, local models or many channels.
Can I use docker run instead of Docker Compose?
OpenClaw's setup script and docs are built around Docker Compose. With your own docker run command or Compose file, you have to recreate what the bundled file does: mount the three state folders, publish port 18789, pass the Gateway token, and add host.docker.internal if the agent uses a model running on the host.
Can I run several OpenClaw containers on the same data for uptime?
No. OpenClaw's docs say to keep one Gateway per state volume; a shared volume is not a way to scale. For separate people or customers, run a separate Gateway, with its own state, for each.
Is OpenClaw's agent sandbox the same as running it in Docker?
No. Running the Gateway in a container isolates OpenClaw from your host. The agent sandbox is a separate setting, off by default, that runs the agent's tools in their own containers; enable it with OPENCLAW_SANDBOX=1 when you run the setup script.





