# How do you run OpenClaw in Docker?

Clone the repo and run ./scripts/docker/setup.sh: it onboards you, writes a Gateway token and starts Docker Compose. Below: channels, upgrades and network safety.

Tool: OpenClaw. By ColdIQ team. Updated 2026-12-02. Source: https://coldiq.com/university/openclaw/openclaw-docker

## In short

- Docker is optional. The docs suggest it for an isolated, throwaway Gateway or a server where you do not want local installs.
- You need Docker Desktop or Docker Engine with Compose v2. A local image build needs at least 6 GB of RAM; a pre-built image avoids that build.
- The setup script builds or pulls the image, runs onboarding, writes a Gateway token to .env and starts the Gateway with Docker Compose.
- Official images live at ghcr.io/openclaw/openclaw, with a Docker Hub copy at openclaw/openclaw. The docs say to avoid unofficial mirrors.
- Running the Gateway in a container is not the same as sandboxing. The sandbox, which isolates the agent’s commands, is a separate setting and is off by default.

## Steps

1. Install Docker with Compose v2, then clone the OpenClaw repository.
2. Run ./scripts/docker/setup.sh, with a pre-built image if you want a fast start.
3. Open http://127.0.0.1:18789/, paste the token from .env, then add a channel.

## Should you run OpenClaw in Docker?

Docker packs a program and everything it needs into a container, a sealed box that runs the same way on any machine. For OpenClaw, that means the Gateway (the always-on program that links your chat apps to the agent) runs in its own box instead of directly on your system.

The docs call Docker optional. It is a good choice for a VPS (a rented cloud server), a home server, or a test setup you may want to delete. If you already work on your own Mac or PC and just want the assistant, the normal installer is simpler.

- Docker Desktop or Docker Engine, plus Docker Compose v2.
- At least 6 GB of RAM if you build the image yourself. A pre-built image skips this build.
- Enough disk space for images and logs.


## How do you set up the OpenClaw Docker Gateway?

These are the official steps. Run them from the root of the OpenClaw repository.

1. Get the code: git clone https://github.com/openclaw/openclaw.git, then cd openclaw.
2. To skip the local build, choose the pre-built image: export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest".
3. Run the setup script: ./scripts/docker/setup.sh
4. Answer the onboarding questions, such as your model provider API key. The script writes a Gateway token to the .env file and starts the Gateway with Docker Compose.
5. Open http://127.0.0.1:18789/ in your browser and paste the token from .env into Settings.

Tip: If you lose the dashboard link, run docker compose run --rm openclaw-cli dashboard --no-open to print it again.


## How do you connect Telegram or WhatsApp?

Channel commands run through the openclaw-cli service in the same Compose setup. The docs name Telegram as the fastest channel to set up, because it only needs a bot token.

- Telegram: docker compose run --rm openclaw-cli channels add --channel telegram --token "<token>"
- WhatsApp: docker compose run --rm openclaw-cli channels login, then scan the QR code with your phone.
- Discord: docker compose run --rm openclaw-cli channels add --channel discord --token "<token>"

> Send me a short message every weekday at 8 a.m. with the three most important emails and meetings of the day. Only send it to me, and do not reply to anyone for me.


## Can OpenClaw use a browser inside Docker?

Yes, but the browser must be inside the container. The browser on your laptop is a different machine from the container’s point of view.

For a new install, the docs recommend the browser-equipped image: set OPENCLAW_IMAGE to ghcr.io/openclaw/openclaw:latest-browser before you run the setup script. For a pinned version, pick a release’s -browser tag instead of latest-browser.

Managed browsers run headless by default, which means without a visible window. That is normal on a server.

To check that the browser really works, open the Browser panel in the Control UI chat, load a page and confirm that the snapshot appears. The docs note that loading the dashboard alone does not prove Chromium can start.


## How do you upgrade OpenClaw in Docker?

Back up your state volume first. Then pull the new images and recreate the Gateway with the same Compose files you used before.

Keep one Gateway replica per state volume. Two containers writing to the same OpenClaw state at once can damage it.

1. docker compose pull openclaw-gateway openclaw-cli
2. docker compose stop openclaw-gateway
3. docker compose up -d openclaw-gateway

Tip: Do not rerun the setup script from an empty terminal only to change the image. The script rewrites .env from your current shell and its defaults.


## How do you keep a Docker Gateway safe?

A container is not a firewall. The setup script sets the Gateway bind to lan, so the published port works from your host and can be reached from your network. Keep authentication on, such as the token the setup script creates.

On a VPS or any public host, read the security page before you open ports, and check the Docker DOCKER-USER firewall chain. Docker can publish ports in ways that skip your usual firewall rules.

Run openclaw security audit, from the openclaw-cli service, after setup and after each network change. Turn on the sandbox if your agent runs commands or reads untrusted pages.

Sandboxing is separate from where the Gateway runs. The docs say it is off by default and does not need the Gateway itself to be in a container. The default Docker sandbox backend uses only the docker command, and you can set the backend to podman to use Podman instead.


## Where does the Docker setup keep your data?

Docker Compose mounts your OpenClaw config folder to /home/node/.openclaw inside the container, and your workspace to /home/node/.openclaw/workspace. Your settings, memory and skills therefore live on the host disk, not inside the container, and survive an image upgrade.

The docs say to keep the OpenClaw database on a persistent local disk of the Docker host, through a local bind mount or a local Docker volume. Back up these folders before every upgrade.

For a server with no internet, the docs describe an offline path: load the image with docker load, set OPENCLAW_IMAGE, then run ./scripts/docker/setup.sh --offline. For a fixed version, use a release tag such as 2026.9.3 instead of latest.


## Command

```
git clone https://github.com/openclaw/openclaw.git && cd openclaw && ./scripts/docker/setup.sh
```

## Sources

- [OpenClaw docs: Docker](https://docs.openclaw.ai/install/docker)
- [OpenClaw docs: Docker networking and storage](https://docs.openclaw.ai/install/docker/networking-and-storage)
- [OpenClaw docs: Docker sandbox and troubleshooting](https://docs.openclaw.ai/install/docker/sandbox-and-troubleshooting)
- [OpenClaw docs: Security](https://docs.openclaw.ai/gateway/security)
- [OpenClaw docs: Sandboxing](https://docs.openclaw.ai/gateway/sandboxing)
- [OpenClaw container images (GitHub)](https://github.com/openclaw/openclaw/pkgs/container/openclaw)

## Questions

**Is there an official OpenClaw Docker image?** Yes. The main registry is ghcr.io/openclaw/openclaw, with a Docker Hub copy at openclaw/openclaw. Release tags are versioned, and -browser tags include Chromium.

**What port does OpenClaw use in Docker?** The Control UI and Gateway use port 18789 by default. You can change the host port with OPENCLAW_GATEWAY_PORT.

**Does the Docker image include Claude Code?** No. The docs say the image does not pre-install Claude Code. Use a home volume if you install it inside the container and want it to persist.

**Can I use Podman instead of Docker?** For the sandbox backend, yes: set the backend to podman. The Gateway setup script is written for Docker with Compose.


## Related

- [Is OpenClaw safe? OpenClaw security explained](https://coldiq.com/university/openclaw/openclaw-security)

## Try ColdIQ free

ColdIQ gives new accounts up to 1,450 free credits as they get started, no credit card required.
One subscription covers 40+ B2B data providers for finding, enriching and verifying
contacts and companies, through the web app, the API or the MCP server for AI agents.

1. Create an account: https://coldiq.com/marketplace/sign-up?utm_source=ai-assistant&utm_medium=markdown&utm_content=university
2. Run a first search on your own market with the free credits.
3. Connect the MCP server to Claude, ChatGPT or Cursor: https://coldiq.com/mcp
