Fix: OpenClaw in Docker — Connection Refused, Port Mapping, and Network Issues
Running OpenClaw in Docker and getting connection refused? Common issues with port mapping, bind addresses, DNS resolution, and WebSocket upgrades explained with fixes.
Error: 401 Unauthorized: bot token is invalidFix:
/mybots to see your existing botsopenclaw configure --set channels.telegram.botToken='your-new-token'
openclaw gateway restartCommon mistakes:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyzSymptom: Bot is online in Telegram but doesn’t respond to messages.
Check 1: Is the webhook set?
curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo"If the webhook URL is empty or wrong, OpenClaw may be using polling instead. For VPS/server deployments, webhooks are more reliable:
# OpenClaw sets this automatically, but you can verify:
curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo" | python3 -m json.toolCheck 2: Is your server reachable?
Telegram requires HTTPS with a valid certificate. If you’re using a self-signed cert, Telegram won’t send webhook updates.
Fix: Use a reverse proxy with Let’s Encrypt:
# With Caddy (automatic HTTPS)
caddy reverse-proxy --from openclaw.yourdomain.com --to localhost:18789Check 3: Firewall
# Telegram sends webhooks from these IP ranges:
# 149.154.160.0/20
# 91.108.4.0/22
# Ensure your firewall allows inbound HTTPS
sudo ufw allow 443/tcpSymptom: Bot works in direct messages but ignores group chat messages.
Fix: Disable privacy mode in BotFather:
/mybots → Select bot → Bot Settings → Group PrivacyWithout this, Telegram only forwards messages that mention the bot or start with /.
Symptom: The QR code appears but WhatsApp on your phone won’t scan it, or it scans but immediately disconnects.
Fix 1: Refresh the QR code — they expire after ~60 seconds:
openclaw configure --section whatsapp
# A fresh QR will be generatedFix 2: Make sure you’re scanning with the right WhatsApp account. Go to:
Fix 3: Time sync — if your server clock is significantly off, the QR auth may fail:
# Check server time
date
# Sync with NTP
sudo timedatectl set-ntp trueSymptom: WhatsApp works for a few hours/days then stops. You need to re-scan the QR.
Cause: WhatsApp session data isn’t persisting across container restarts.
Fix: Ensure the session data directory is mounted as a volume:
# docker-compose.yml
services:
openclaw:
volumes:
- ./openclaw-data:/home/node/.openclawThe session state is stored in ~/.openclaw/ — if this directory isn’t persistent, every container restart requires a new QR scan.
Symptom: OpenClaw processes the message but the reply never appears in WhatsApp.
Check 1: Rate limiting — WhatsApp has strict rate limits for unofficial API usage. If you’re sending too many messages too quickly, they’ll be silently dropped.
Check 2: Message format — WhatsApp has different formatting rules than other platforms:
# ❌ Won't render in WhatsApp:
## Heading
| Table | Data |
[Link text](url)
# ✅ Works in WhatsApp:
*Bold text*
_Italic text_
~Strikethrough~
```text
Code blockOpenClaw handles most of this automatically, but custom templates may need adjustment.
Symptom: Bot is online (green dot) in Discord but ignores messages.
Fix: Check bot permissions and intents:
Symptom: Bot receives events but message content is empty.
Cause: Message Content Intent not enabled. Without it, Discord sends the event but strips the message body.
# Check all configured channels
openclaw status
# View channel-specific logs
openclaw gateway logs | grep -i "telegram\|whatsapp\|discord"
# Test a specific channel
openclaw test-channel telegramAI & Cloud Advisor with 18+ years experience. Author of 8 technical books, creator of Ansible Pilot, and instructor at CopyPasteLearn Academy. Speaker at KubeCon EU & Red Hat Summit 2026.
Running OpenClaw in Docker and getting connection refused? Common issues with port mapping, bind addresses, DNS resolution, and WebSocket upgrades explained with fixes.
Getting the allowedorigins error when starting your OpenClaw gateway? Here is exactly how to fix it, with step-by-step configuration for local network, VPS, and reverse proxy setups.
Troubleshoot OpenClaw API key issues across OpenAI, Anthropic, and GitHub Copilot. Covers 401 errors, invalid key formats, rate limits, and model fallback configuration.