A minimal, production-ready guide to deploying OpenClaw (standalone) using Docker on a Linux based Server.
Caution
SECURITY WARNING: DO NOT EXPOSE THIS PUBLICLY WITHOUT PROTECTION
The OpenClaw Gateway is designed as an internal communication component. It should NOT be open to the public internet indiscriminately.
You MUST restrict access to your domain using one of the following methods:
- Cloudflare Access / Zero Trust: Put the domain behind an authentication layer. SSL is included and free (RECOMMENDED!)
- Firewall Rules: Allow inbound traffic on port 80/443 ONLY from your specific IP address. You will need to use
allowInsecureAuthon the OpenClaw config, if you want to access it without HTTPS. - VPN: Only allow access while connected to your private VPN. You will need to use
allowInsecureAuthon the OpenClaw config, if you want to access it without HTTPS.
Get a Domain and register it on Cloudflare. You need to enable the "SSL Flexible" setting to make it work without any SSL hassle on your Server. Either change it domain-wide (on .../ssl-tls/configuration) or create a specific rule.
⚠️ If you don't want to use Cloudflare, you will need to configure SSL yourself (e.g. with Let's Encrypt) and expose port 443 instead of 80.
Then, add an A-Record pointing your domain to your server's IP address (with Cloudflare proxy enabled).
OpenClaw runs as the node user (UID 1000). We must pre-create the host volumes and assign the correct ownership, otherwise the container will crash with EACCES errors.
⚠️ Better don't use system directories like /root - they are blacklisted by OpenClaw e.g. when spawning sandboxed agents.
mkdir -p /home/openclaw/workspace
chown -R 1000:1000 /home/openclawGenerate a random Gateway Token using this:
export OPENCLAW_GATEWAY_TOKEN=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 32; echo '')
echo "Your Gateway Token is: $OPENCLAW_GATEWAY_TOKEN"docker run -d \
--name openclaw \
--restart unless-stopped \
-p 80:18789 \
-v /home/openclaw:/home/node/.openclaw \
-e OPENCLAW_GATEWAY_TOKEN=$OPENCLAW_GATEWAY_TOKEN \
ghcr.io/openclaw/openclaw:latest \
node openclaw.mjs gateway --allow-unconfigured --bind lanOptionally check docker logs -f openclaw to see if there are any errors.
Open https://your-domain.com/overview and enter your pre-generated Gateway Token from above. Click Connect. You will see
disconnected (1008): pairing required
Then, lets do the pairing. Run
docker exec -it openclaw node openclaw.mjs devices list
and you should find a Pending request. Copy the Request UUID and paste it into this command and run it:
docker exec -it openclaw node openclaw.mjs devices approve <request-uuid>
Then, reload the Overview page in your Browser and it should say Connected. Your device has been paired successfully! Now run this to start the onboarding and you are done!
docker exec -it openclaw node openclaw.mjs onboard
