OpenClaw (formerly Clawdbot and Moltbot) is an open source ai-assistant that can do things on your behalf and is getting a lot of attention recently. This post is me documenting my process to get it up and running in a docker container as there are currently some issues getting it setup, so this might be helpful to others.
- Clone the repository:
git clone https://github.com/openclaw/openclaw.git - Change to the project folder:
cd openclaw - Run
./docker-setup.shto build the image and do some initial setup - Run the containers:
docker compose up -d - Update the
OPENCLAW_ DIRandOPENCLAW_WORKSPACE_DIRvalues in.envto point to your desired locations - Run
docker compose run --rm openclaw-cli dashboard --no-opento generate a stub config file (I suggest creating the directories below and changing ownership before running this) - Update the ownership of the new folder:
sudo chown -R 1000:1000 $HOME/path/to/openclaw/.openclawandsudo chown -R 1000:1000 $HOME/path/to/openclaw/.openclaw/workspace - Run the on-boarding process (this command is different to avoid problems with the current instructions from openclaw - see below):
docker compose exec openclaw-gateway node /app/openclaw.mjs onboard- When asked for how you want to "hatch", say later because we still need to pair your device
- Run
docker compose exec openclaw-cli dashboard --no-open - You will get a token in the "Dashboard ready" portion; copy the link
- Open
.envand paste the token into theOPENCLAW_GATEWAY_TOKENvalue - Open
.openclaw/openclaw.jsonand do the following:- Change
bindtolan - Add the following to
gateway:
"auth": {"mode": "token","token": "YOUR_TOKEN"},"remote": {"url": "ws://openclaw-gateway:18789","token": "YOUR_TOKEN"}
- Open a terminal in your host machine and open an ssh tunnel with this command:
ssh -N -L 18789:127.0.0.1:18789 user@192.x.x.x(your machine's network IP) - Restart
docker compose up -d - Open the localhost link in a browser (with the #token=1234)
- You should get a "pairing required" error
- Run this to see which devices are available:
docker compose exec openclaw-gateway node /app/openclaw.mjs devices list - It will show pending devices; copy the request ID
- Paste it in this command and run it to allow:
docker compose exec openclaw-gateway node /app/openclaw.mjs devices approve <requestId> - You should now be able to use openclaw in a docker context!
Model selection
I'm new to all this, but I have had some level of success with lower quants of Qwen3-Coder-Next-GGUF for slower and local tasks. However, these agents really require a lot of context, so it's currently challenging to get them working properly with local ollama models and the Anthropic/OpenAI/Gemini models can get expensive for this.
Safeguarding/optimizing
These changes can be made in the configuration directly, or you can just ask OpenClaw to do them:
- Limit "heartbeat" to use a less powerful model and less often
- Create an active hours block so it only runs when needed
- Use a service like n8n or Zapier as a middle service so you don't give credentials directly to OpenClaw
Troubleshooting
Following the steps to install openclaw on docker compose, I kept running into problems with the local IP routing.
They recommend this command to get your auth token: docker compose run --rm openclaw-cli dashboard --no-open
Followed by docker compose run --rm openclaw-cli devices list to list the devices. This resulted in the first error for me:
[openclaw] CLI failed: Error: gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/node/.openclaw/openclaw.json
Bind: lan
Since I'm running this in a docker container, the address is wrong. Docker containers on the same host let you reference one another with their name. We can explicitly define the URL like so:
docker compose run --rm openclaw-cli devices list --url ws://openclaw-gateway:18789 --token YOUR_TOKEN
Now there's another error:
gateway connect failed: Error: pairing required[openclaw] CLI failed: Error: gateway closed (1008): pairing required
Gateway target: ws://openclaw-gateway:18789
Source: cli --url
Config: /home/node/.openclaw/openclaw.json
We are connecting to the gateway, but cannot run the command without it starting, so we should run it directly: docker compose exec openclaw-gateway node /app/openclaw.mjs devices list
Next, I ran into a mismatch error:
[openclaw] Failed to start CLI: Error: gateway closed (1008): unauthorized: gateway token mismatch (set gateway.remote.token to match gateway.auth.toke)
To resolve this, make sure OPENCLAW_GATEWAY_TOKEN is the same as both gateway.auth.token and gateway.remote.token . You may need to restart the container docker compose restart
Now I was able to run the commands listed in the openclaw guide from the container directly:
- Onboard:
docker compose exec openclaw-cli node /app/openclaw.mjs onboard - List devices
docker compose exec openclaw-gateway node /app/openclaw.mjs devices list - Approve devices
docker compose exec openclaw-gateway node /app/openclaw.mjs devices approve <requestId>