沙盒 CLI
沙盒 CLI
Section titled “沙盒 CLI”管理基于 Docker 的沙盒容器以实现隔离的代理执行。
OpenClaw 可以在隔离的 Docker 容器中运行代理以确保安全。sandbox 命令帮助您管理这些容器,特别是在更新或配置更改之后。
openclaw sandbox explain
Section titled “openclaw sandbox explain”检查 有效的 沙盒模式/范围/工作区访问、沙盒工具策略和提升的门 (带有修复配置键路径)。
openclaw sandbox explainopenclaw sandbox explain --session agent:main:mainopenclaw sandbox explain --agent workopenclaw sandbox explain --jsonopenclaw sandbox list
Section titled “openclaw sandbox list”列出所有沙盒容器及其状态和配置。
openclaw sandbox listopenclaw sandbox list --browser # 仅列出浏览器容器openclaw sandbox list --json # JSON 输出输出包括:
- 容器名称和状态 (运行中/已停止)
- Docker 镜像以及它是否与配置匹配
- 年龄 (自创建以来的时间)
- 空闲时间 (自上次使用以来的时间)
- 关联的会话/代理
openclaw sandbox recreate
Section titled “openclaw sandbox recreate”删除沙盒容器以强制使用更新的镜像/配置重新创建。
openclaw sandbox recreate --all # 重新创建所有容器openclaw sandbox recreate --session main # 特定会话openclaw sandbox recreate --agent mybot # 特定代理openclaw sandbox recreate --browser # 仅浏览器容器openclaw sandbox recreate --all --force # 跳过确认选项:
--all: 重新创建所有沙盒容器--session <key>: 为特定会话重新创建容器--agent <id>: 为特定代理重新创建容器--browser: 仅重新创建浏览器容器--force: 跳过确认提示
重要: 容器会在下次使用代理时自动重新创建。
更新 Docker 镜像后
Section titled “更新 Docker 镜像后”# 拉取新镜像docker pull openclaw-sandbox:latestdocker tag openclaw-sandbox:latest openclaw-sandbox:bookworm-slim
# 更新配置以使用新镜像# 编辑配置: agents.defaults.sandbox.docker.image (或 agents.list[].sandbox.docker.image)
# 重新创建容器openclaw sandbox recreate --all更改沙盒配置后
Section titled “更改沙盒配置后”# 编辑配置: agents.defaults.sandbox.* (或 agents.list[].sandbox.*)
# 重新创建以应用新配置openclaw sandbox recreate --all更改 setupCommand 后
Section titled “更改 setupCommand 后”openclaw sandbox recreate --all# 或仅一个代理:openclaw sandbox recreate --agent family