Docker Compose

Run OpenClaw behind the ControlClaw firewall with one Docker Compose file. OpenClaw can reach the internet only through the firewall.

One Compose file starts three containers on any Linux server with Docker:

  • firewall: the ControlClaw firewall, its panel and its proxy.
  • egress: a small Alpine container that owns OpenClaw's network. Its packet filter drops everything except traffic to the firewall's proxy.
  • openclaw: OpenClaw's gateway and Control UI, running inside egress's network.

OpenClaw has no way to change the filter, and no DNS: the proxy looks up names for it. A program that ignores the proxy, such as curl --noproxy '*', gets nowhere.

If you can run commands on the server, npx controlclaw up --all is the stronger choice: the panel can then also set OpenClaw's models and bots, and stop it. Use this file when you manage your containers with Compose, or on a platform such as Coolify or Dokploy.

What you need

  • Linux (amd64 or arm64) with Docker 28 or newer and Compose 2.24.4 or newer.
  • 4 GB of RAM or more.

Download the Compose file

On the server
mkdir controlclaw-openclaw && cd controlclaw-openclaw
curl -fsSLO https://raw.githubusercontent.com/madarco/controlclaw/main/standalone/deploy/compose/compose.yaml

Set OpenClaw's gateway token

OpenClaw's Control UI asks for this token. The file refuses to start without one.

echo "OPENCLAW_GATEWAY_TOKEN=$(openssl rand -hex 32)" > .env

Start it

docker compose up -d

The first start takes a few minutes while the images download. egress waits for the firewall to be healthy, and OpenClaw waits for egress.

Open the panel

The panel (port 8800) and the Control UI (port 18789) listen on the server's loopback only. From your computer, open a tunnel:

ssh -L 8800:127.0.0.1:8800 -L 18789:127.0.0.1:18789 you@your-server

The panel asks for a one-time setup token. It is in the firewall's log:

docker compose logs firewall | grep -i "setup token"

Open http://127.0.0.1:8800, paste the token and set the admin password right away.

Set up OpenClaw

Open http://127.0.0.1:18789 and log in with the gateway token from .env. Choose your model provider and add your key, as OpenClaw's own docs describe.

Check that it works

Ask OpenClaw to fetch a web page. The request shows in the panel's Activity. Then try a request that skips the proxy:

docker compose exec openclaw curl -sS --max-time 10 --noproxy '*' https://example.com

It times out: the only way out is the firewall.

Lock it down

A new firewall allows every site and logs it. In the panel, open Internet access and set Every other site to Block. Then allow your model provider's host, for example api.anthropic.com, or add the key in the panel instead, which adds its rule for you.

Update or remove

The file pins both images. To update, download the file again, then docker compose pull and docker compose up -d. To remove everything, volumes included: docker compose down -v. That deletes the firewall's certificate authority and every secret it holds.

Questions

Why not an internal Docker network? Some platforms attach their own network to every service, which gives OpenClaw a second way out. The packet filter lives in OpenClaw's own network namespace, so it holds whatever networks Docker adds.

What happens when the firewall gets a new address? Its health check writes the address to a shared volume. egress reads it every 10 seconds and moves the filter.

On this page