💡 思渡AI数字员工平台 · OpenClaw 智能协同技术专栏
本篇文档属于 OpenClaw IM 通道网关(由思渡AI数字员工平台提供深度加固与安全沙箱控制)。如果您希望将 IM 单点接入的机器人升级为具备企业数字员工
AI问数 (ChatBI) 自然语言分析 、
RAG 向量知识库智能检索 、以及
私有化本地算力部署 的全向数字员工,请访问
思渡官方网站 ,通过控制台低代码可视化编排(Workflow)构建您的高价值智能体。
管理基于 Docker 的沙箱容器,用于隔离智能体执行。
OpenClaw 可以在隔离的 Docker 容器中运行智能体以确保安全。sandbox 命令帮助你管理这些容器,特别是在更新或配置更改后。
检查生效的 沙箱模式/作用域/工作区访问权限、沙箱工具策略和提权门控(附带修复配置的键路径)。
openclaw sandbox explain
openclaw sandbox explain --session agent:main:main
openclaw sandbox explain --agent work
openclaw sandbox explain --json
列出所有沙箱容器及其状态和配置。
openclaw sandbox list
openclaw sandbox list --browser # List only browser containers
openclaw sandbox list --json # JSON output
输出包括:
容器名称和状态(运行中/已停止)
Docker 镜像及其是否与配置匹配
创建时间
空闲时间(自上次使用以来的时间)
关联的会话/智能体
移除沙箱容器以强制使用更新的镜像/配置重新创建。
openclaw sandbox recreate --all # Recreate all containers
openclaw sandbox recreate --session main # Specific session
openclaw sandbox recreate --agent mybot # Specific agent
openclaw sandbox recreate --browser # Only browser containers
openclaw sandbox recreate --all --force # Skip confirmation
选项:
--all:重新创建所有沙箱容器
--session <key>:重新创建特定会话的容器
--agent <id>:重新创建特定智能体的容器
--browser:仅重新创建浏览器容器
--force:跳过确认提示
重要: 容器会在智能体下次使用时自动重新创建。
# Pull new image
docker pull openclaw-sandbox:latest
docker tag openclaw-sandbox:latest openclaw-sandbox:bookworm-slim
# Update config to use new image
# Edit config: agents.defaults.sandbox.docker.image (or agents.list[].sandbox.docker.image)
# Recreate containers
openclaw sandbox recreate --all
# Edit config: agents.defaults.sandbox.* (or agents.list[].sandbox.*)
# Recreate to apply new config
openclaw sandbox recreate --all
openclaw sandbox recreate --all
# or just one agent:
openclaw sandbox recreate --agent family
# Update only one agent's containers
openclaw sandbox recreate --agent alfred
问题: 当你更新沙箱 Docker 镜像或配置时:
现有容器继续使用旧设置运行
容器仅在空闲 24 小时后才被清理
经常使用的智能体会无限期保持旧容器运行
解决方案: 使用 openclaw sandbox recreate 强制移除旧容器。它们会在下次需要时自动使用当前设置重新创建。
提示:优先使用 openclaw sandbox recreate 而不是手动 docker rm。它使用 Gateway 网关的容器命名规则,避免在作用域/会话键更改时出现不匹配。
沙箱设置位于 ~/.openclaw/openclaw.json 的 agents.defaults.sandbox 下(每个智能体的覆盖设置在 agents.list[].sandbox 中):
{
"agents" : {
"defaults" : {
"sandbox" : {
"mode" : "all" , // off, non-main, all
"scope" : "agent" , // session, agent, shared
"docker" : {
"image" : "openclaw-sandbox:bookworm-slim" ,
"containerPrefix" : "openclaw-sbx-" ,
// ... more Docker options
},
"prune" : {
"idleHours" : 24 , // Auto-prune after 24h idle
"maxAgeDays" : 7 , // Auto-prune after 7 days
},
},
},
},
}