ホーム 車・バイク 🐳 OpenClaw Docker Troubleshooting Complete Guide (With Workspace Version)

🐳 OpenClaw Docker Troubleshooting Complete Guide (With Workspace Version)

三浦 拓海 三浦 拓海 • 更新: • 公開: • 読了約 22 分
目次

I have compiled common errors and solutions encountered when running OpenClaw in Docker.

I recreated this because it was difficult to understand.
I wrote an article about how to fix errors that I have experienced.

Table of Contents

n129a2248a3a0
  1. Docker Desktop is not running

  2. Cannot access port / Cannot connect to gateway

  3. CLI cannot connect to gateway (1006 abnormal closure)

  4. Dashboard: "unauthorized: gateway token mismatch"

  5. Dashboard: "pairing required"

Docker Desktop is not running

Error Details
ERROR: Cannot connect to the Docker daemon at unix:///Users/<user>/.docker/run/docker.sock
Cause

Executing commands while Docker Desktop is not running.

Solution

️ Work on Host OS:

For macOS, start Docker Desktop from the terminal with the following command:

# Docker Desktop を起動
open -a "Docker Desktop"
起動確認
docker info

Startup is complete if the docker info command displays information normally.

Cannot access port / Cannot connect to gateway

Error Details
  • The Gateway container is running

  • Cannot access the Gateway from a browser or CLI

  • Connection refused error occurs

Cause

The port binding configuration in docker-compose.yml does not match the OPENCLAW_GATEWAY_BIND setting in .env.

In the default compose file:

ports:
 - "$OPENCLAW_GATEWAY_PORT:-18789:18789"

It is configured like this, binding to 127.0.0.1 (localhost only), but in .env, it may be set to OPENCLAW_GATEWAY_BIND=lan.

Solution

Work on Host OS: Edit docker-compose.yml

To allow LAN access (all network interfaces):

# docker-compose.yml
ports:
 - "0.0.0.0:$OPENCLAW_GATEWAY_PORT:-18789:18789"
 - "0.0.0.0:$OPENCLAW_BRIDGE_PORT:-18790:18790"

To allow access only from localhost:

# docker-compose.yml
ports:
 - "127.0.0.1:$OPENCLAW_GATEWAY_PORT:-18789:18789"
 - "127.0.0.1:$OPENCLAW_BRIDGE_PORT:-18790:18790"

After editing, restart the service:

docker compose down
docker compose up -d
How to verify

️ Work on Host OS:

# サービスの状態確認
docker compose ps
ポートバインディングの確認
netstat -an | grep -E "18789|18790"
Linux の場合
ss -ltn | grep -E "18789|18790"

Expected output for 0.0.0.0 binding:

tcp4 0 0 .18789 *. LISTEN

Expected output for 127.0.0.1 binding:

tcp4 0 0 127.0.0.1.18789 . LISTEN

CLI cannot connect to gateway (1006 abnormal closure)

Error details
[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
Cause
  1. The CLI container is trying to connect to ws://127.0.0.1:18789, which points to its own loopback, not the Gateway container

  2. The tokens in .env and openclaw.json do not match

Solution

Step 1: Fix Docker Compose network mode

Work on Host OS: Edit docker-compose.yml

Configure the CLI to share the Gateway's network:

services:
 openclaw-cli:
 network_mode: "service:openclaw-gateway"
 # ... その他のCLI設定

Step 2: Synchronize tokens

Ensure the tokens in .env and openclaw.json match.

️ Work on Host OS:

# .env のトークンを確認
cat .env | grep OPENCLAW_GATEWAY_TOKEN
openclaw.json のトークンを確認
cat ~/.openclaw/openclaw.json | grep -A2 '"auth"'

Work on Host OS: Edit ~/.openclaw/openclaw.json

 "gateway": 
 "auth": 
 "mode": "token",
 "token": "SAME_TOKEN_AS_IN_ENV"
 ,
 "remote": 
 "token": "SAME_TOKEN_AS_IN_ENV"
 
 

Please set the token to the same value as in the .env file.

️ Work on Host OS: Restart Gateway

docker compose restart openclaw-gateway
How to verify

️ Work on Host OS:

# CLI 接続をテスト
docker compose run --rm openclaw-cli devices list

If the device list is displayed without errors, it is successful.

Dashboard: "unauthorized: gateway token mismatch"

Error details
disconnected (1008): unauthorized: gateway token mismatch (open the dashboard URL and paste the token in Control UI settings)
Cause

The old token stored in the browser's local storage does not match the Gateway's current token.

Solution

Option 1: Use the correct URL with the token

️ Work on Host OS: Retrieve token

cat .env | grep OPENCLAW_GATEWAY_TOKEN

Use the retrieved token to access the dashboard via the following URL:

http://localhost:18789/#token=<YOUR_TOKEN>

Or:

http://127.0.0.1:18789/#token=<YOUR_TOKEN>

Option 2: Clear browser local storage

  1. Open the dashboard page (http://localhost:18789/) in your browser

  2. Open DevTools (F12 or Cmd+Option+I on macOS)

  3. Go to the Application tab

  4. Expand Local Storage → http://localhost:18789

  5. Delete all keys

  6. Reload the page

  7. Access using the correct URL with the token from Option 1

How to verify

️ Work on the Host OS:

# Gateway のログで接続成功を確認
docker compose logs -f openclaw-gateway | grep -E "(connected|authorized)"

Success if an entry like the following is displayed:

[gateway] connected client=openclaw-control-ui

Dashboard: "pairing required"

Error details
disconnected (1008): pairing required
Cause

The browser/device is attempting to connect to the Gateway but has not yet been paired/authorized.

Solution

Step 1: Check for pending pairing requests

️ Work on the Host OS:

docker compose run --rm openclaw-cli devices list

Check if the device is displayed in the "Pending" section.

Step 2: Approve the device waiting for pairing

️ Work on Host OS:

# 特定のデバイスを承認
docker compose run --rm openclaw-cli devices approve <DEVICE_ID>
すべてのペアリング待ちデバイスを承認 (利用可能な場合)
docker compose run --rm openclaw-cli devices approve --all

Step 3: Enable auto-approval (Optional)

Note: This reduces security. Use only in trusted environments.

Work on Host OS: Edit ~/.openclaw/openclaw.json

 "nodes": 
 "denyCommands": [
 "camera.snap",
 "camera.clip",
 "screen.record",
 "calendar.add",
 "contacts.add",
 "reminders.add"
 ],
 "approvals": "auto"
 

️ Work on Host OS: Restart Gateway

docker compose restart openclaw-gateway
How to verify

️ Work on Host OS:

# デバイスリストを確認 - "Paired" セクションに表示されるはず
docker compose run --rm openclaw-cli devices list
Gateway のログで自動承認されたデバイスを確認
docker compose logs openclaw-gateway | grep "auto-approved"

Expected output:

Paired (1)
┌────────────────────────────────────────────┬────────────┬──────────────────────────────┬────────────┐
│ Device │ Roles │ Scopes │ Tokens │
├────────────────────────────────────────────┼────────────┼──────────────────────────────┼────────────┤
│ <device_id> │ operator │ operator.admin, operator.... │ operator │
└────────────────────────────────────────────┴────────────┴──────────────────────────────┴────────────┘

Frequently used commands

Docker Compose commands

️ Work on Host OS:

# サービスを起動
docker compose up -d
特定のサービスのみ起動
docker compose up -d openclaw-gateway
サービスを再起動
docker compose restart openclaw-gateway
すべてのサービスを停止
docker compose down
ログを表示
docker compose logs -f openclaw-gateway
CLI コマンドを実行
docker compose run --rm openclaw-cli <command>
ステータスを確認
docker compose ps
起動中のコンテナでコマンドを実行
docker compose exec openclaw-gateway <command>
CLI commands

️ Work on Host OS:

# デバイス管理
docker compose run --rm openclaw-cli devices list
docker compose run --rm openclaw-cli devices approve <device_id>
docker compose run --rm openclaw-cli devices reject <device_id>
設定管理
docker compose run --rm openclaw-cli config get <key>
docker compose run --rm openclaw-cli config set <key> <value>
ヘルスチェック
docker compose run --rm openclaw-cli doctor

Diagnostic checklist

Before reporting an issue, please check the following:

Docker
  • [ ] Docker Desktop is running (docker info works)

  • [ ] Gateway container is in Up state (docker compose ps)

  • [ ] Ports are correctly bound (netstat or ss)

Configuration
  • [ ] The .env file exists and is set with the correct values

  • [ ] OPENCLAW_GATEWAY_TOKEN is set in .env

  • [ ] gateway.auth.token and gateway.remote.token in openclaw.json match the token

Network
  • [ ] Port bindings match the intended access (0.0.0.0 for LAN, 127.0.0.1 for localhost)

  • [ ] network_mode: "service:openclaw-gateway" is used when running the CLI in a container

Authentication
  • [ ] The Dashboard URL includes the token: http://localhost:18789/#token=...

  • [ ] Browser local storage is cleared when switching environments

  • [ ] The device is authorized ("Pending" is not displayed in the devices list)

Related Resources

  • General gateway troubleshooting: /gateway/troubleshooting

  • Authentication and pairing docs: /gateway/authentication

  • Channel-specific pairing: /channels/pairing

  • Docker installation guide: /install/docker

We hope this article helps with your OpenClaw Docker troubleshooting. If the issue persists, please check the official documentation or community forums.


同じカテゴリの記事

三浦 拓海
コンテンツディレクター 三浦 拓海
プロフィールを見る →

映画と連続ドラマの公開情報を追う担当。配給会社のプレスシートと公式サイトの発表日を確認したうえで執筆します。

おすすめの関連記事