Openclaw原版部署(Docker)支持Windows和Linux

前言

之前都是部署的三方的汉化版,但是Openclaw更新太快了,三方的跟不上,并且官方就支持中文,这里还是推荐部署原版。

Docker方式无论是Windows还是Linux,操作方式都是一致的。

安装Docker

https://www.psvmc.cn/article/2021-03-15-docker-windows.html

运行

创建项目文件夹openclaw-docker

创建 docker-compose.yml 文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
version: "3.8"

services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw
ports:
- "18789:18789"
volumes:
- ./.openclaw:/home/node/.openclaw
- /var/run/docker.sock:/var/run/docker.sock
environment:
- NODE_ENV=production
- TZ=UTC
restart: unless-stopped
networks:
- openclaw-net

networks:
openclaw-net:
driver: bridge

下载镜像

1
docker pull ghcr.io/openclaw/openclaw:latest

启动

1
docker-compose up -d

这次启动是为了生成配置

修改配置

项目目录下.openclaw/openclaw.json

修改gateway部分

1
2
3
4
5
6
7
8
9
10
11
12
{
"gateway": {
"port":18789,
"mode":"local",
"bind":"lan",
"controlUi":{"allowedOrigins":["*"]},
"auth": {
"mode": "token",
"token": "01ff956287de1fbd5db9b79de79ad20f64ca84e9ca3df28b"
}
}
}

复制token的值

重启

1
2
docker-compose down
docker-compose up -d

这时就可以通过下面的地址访问

http://localhost:18789?token=01ff956287de1fbd5db9b79de79ad20f64ca84e9ca3df28b

查看待批准设备

1
docker exec -it openclaw openclaw devices list

可以看到

1
2
3
4
5
6
7
Pending (1)
┌──────────────────────────────────────┬──────────────────────────────────┬──────────┬────────────┬──────────┬────────┐
│ Request │ Device │ Role │ IP │ Age │ Flags │
├──────────────────────────────────────┼──────────────────────────────────┼──────────┼────────────┼──────────┼────────┤
│ 19a21bb1-3aa4-4a3e-81b9-658f2e763781 │ 9264e4f5f050f2e5d4046480ddb6a02c │ operator │ 172.18.0.1 │ just now │ │
│ │ d8593a69449334e3107a33a7d61f7d70 │ │ │ │ │
└──────────────────────────────────────┴──────────────────────────────────┴──────────┴────────────┴──────────┴────────┘

复制Request进行批准

1
docker exec -it openclaw openclaw devices approve 19a21bb1-3aa4-4a3e-81b9-658f2e763781

设置模型和飞书

1
docker exec -it openclaw openclaw config

批准飞书

1
docker exec -it openclaw openclaw pairing approve feishu ZX7ZKULR

查看模型和飞书设置

1
docker exec -it openclaw openclaw status

其他操作

查看实时日志

1
docker logs -f openclaw

进入容器调试

1
docker exec -it openclaw bash

查看容器资源使用情况

1
docker stats openclaw

重启服务

1
docker-compose restart openclaw

飞书开放平台配置

Openclaw-飞书插件配置