OpenClaw Docker部署和使用
Docker部署方法
1. 使用Git下载项目git clone https://github.com/openclaw/openclaw
2. 进入项目文件夹,执行./docker-setup.sh开始部署
3. 安装完成会提示“Onboarding complete. Use the tokenized dashboard link above to control OpenClaw.”
4. 将安装向导完成时“Dashboard link (with token)”提供的token写入到.env,然后重启容器
部署问题汇总
问题1:国内网络环境,从github下载报错
Step 2/20 : RUN curl -fsSL https://bun.sh/install | bash
---> Running in 72a6453c3efb
###################################################### 76.3%curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
error: Failed to download bun from "https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"
curl: (23) Failed writing body
The command '/bin/sh -c curl -fsSL https://bun.sh/install | bash' returned a non-zero code: 1解决方法
编辑Dockerfile,给脚本执行增加代理,将RUN curl -fsSL https://bun.sh/install | bash替换为以下内容
RUN export ALL_PROXY=socks5h://代理IP:代理端口 \
&& export HTTPS_PROXY=socks5h://代理IP:代理端口 \
&& export HTTP_PROXY=socks5h://代理IP:代理端口 \
&& curl -x socks5h://代理IP:代理端口 -fsSL https://bun.sh/install | bash问题2:安装向导进行初始化设置时报错
Error: EACCES: permission denied, open '/home/node/.openclaw/openclaw.json解决方法
编辑docker-setup.sh,查找以下代码
mkdir -p "$OPENCLAW_CONFIG_DIR"
mkdir -p "$OPENCLAW_WORKSPACE_DIR"在下面增加chown -R 1000:1000 "$OPENCLAW_CONFIG_DIR"
使用技巧
1. HTTP访问Control UI报错“disconnected (1008): control ui requires HTTPS or localhost (secure context)”
修改配置文件允许HTTP访问和认证,编辑/root/.openclaw/openclaw.json,在gateway部分增加"controlUi": { "allowInsecureAuth": true },,修改之后如下,重启容器
"gateway": {
"mode": "local",
"controlUi": { "allowInsecureAuth": true },
"auth": {
"mode": "token",
"token": "3d143d9ebe9cf87ab2104e1af6bda022a4f001498ccdc184"
},
"port": 18789,
"bind": "loopback",
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},2. Control UI配置模型,并将模型应用到Agent
配置模型
- 点击Config -> Models,选择Providers,点击Add Entry,将custom-1修改为模型提供商的名称
- 选择Api类型,输入Api Key,Base Url(接口地址)
- 往下Models部分点击Add,Id(模型ID),name(模型名称)


将模型应用到Agents
点击Config ->Agents,在Primary Model填写“模型提供商/模型ID”
