OpenClaw Docker 安装问题记录
问题一:容器启动后一直崩溃重启
报错信息:
Error response from daemon: cannot join network namespace of container:
Container xxx is restarting, wait until the container is running
原因:
Gateway 容器启动后反复崩溃,导致后续操作无法连接进去。
排查方式:
docker logs openclaw-openclaw-gateway-1
实际根因: 见问题二。
问题二:Control UI 未配置 allowedOrigins
报错信息:
Gateway failed to start: Error: non-loopback Control UI requires
gateway.controlUi.allowedOrigins (set explicit origins), or set
gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true
原因:
docker-compose.yml 中默认绑定模式为 lan(非 loopback),此时必须在 openclaw.json 中显式配置允许的来源域名,否则 Gateway 拒绝启动。
解决方法:
编辑 ~/.openclaw/openclaw.json,添加 allowedOrigins:
{
"gateway": {
"controlUi": {
"allowedOrigins": [
"http://localhost:18789",
"http://你的公网IP:18789"
]
}
}
}
或者临时使用 Host-header 回退(本地测试用):
{
"gateway": {
"controlUi": {
"dangerouslyAllowHostHeaderOriginFallback": true
}
}
}
改完后重启容器:
docker compose down && docker compose up -d
问题三:Telegram 机器人返回配对码,无法直接使用
现象:
向机器人发消息后返回:
OpenClaw: access not configured.
Your Telegram user id: xxxxxxxx
Pairing code: XXXXXXXX
Ask the bot owner to approve with:
openclaw pairing approve telegram XXXXXXXX
原因:
Telegram 频道默认开启了 dmPolicy: "pairing",新用户首次使用需要管理员手动审批配对。
解决方法:
在服务器上执行审批命令:
docker exec -it openclaw-openclaw-gateway-1 node dist/index.js pairing approve telegram <配对码>
审批完成后,重新向机器人发消息即可正常使用。