Sandbox 命令:sandbox
Sandbox 提供隔离的远程环境,用于交互式开发、命令执行、文件访问和可复用镜像。
命令
| 命令 | 用法 | 说明 |
|---|---|---|
connect | bohr sandbox connect <sandbox_id> [flags] | 解析 Sandbox 的数据面连接 |
create | bohr sandbox create [template] [flags] | 创建 Sandbox |
delete | bohr sandbox delete <sandbox_id>... [flags] | 删除一个或多个 Sandbox(破坏性操作) |
describe | bohr sandbox describe <sandbox_id> [flags] | 查看 Sandbox 详情 |
doctor | bohr sandbox doctor [flags] | 检查环境是否就绪 |
exec | bohr sandbox exec <sandbox_id> [command...] [flags] | 在 Sandbox 中执行命令 |
files | bohr sandbox files [command] | 管理 Sandbox 中的文件 |
image | bohr sandbox image [command] | 构建和管理 Sandbox 镜像 |
list | bohr sandbox list [flags] | 列出 Sandbox |
machine | bohr sandbox machine [command] | 浏览 Sandbox 机型规格 |
ps | bohr sandbox ps <sandbox_id> [flags] | 列出 Sandbox 中的进程 |
quota | bohr sandbox quota [flags] | 查看 Sandbox、模板与临时存储的配额和用量 |
template | bohr sandbox template [command] | 管理 Sandbox 模板 |
terminal | bohr sandbox terminal [command] | 管理 Sandbox 内的 PTY 终端会话 |
命令组内的子命令请运行 bohr sandbox <组> --help 查看。
常用参数
| 参数 | 说明 |
|---|---|
-t, --template <name> | Sandbox 模板名称 |
--gpu[=4090\|5090\|l20] | 快速选择 GPU 模板;单独使用 --gpu 时选择 4090 |
--project-id <id> | 将 Sandbox 关联到项目 |
--timeout <seconds> | 自动删除超时时间,默认 12 小时 |
--never-timeout | 禁用自动超时 |
--env <KEY=VALUE> | 设置环境变量,可重复使用 |
-c, --command <command> | sandbox exec 执行的命令 |
--background | 后台运行 exec 命令并返回其 PID |
示例
bohr sandbox machine list --choose-type gpu --sort price
bohr sandbox create --gpu=l20 --project-id 123 --timeout 7200
bohr sandbox exec 456 --command "python /bohr-workspace/main.py"
bohr sandbox files read 456 /bohr-workspace/result.json --destination ./result.json
bohr sandbox quota
bohr sandbox doctor
创建 Sandbox、构建或提交镜像可能产生费用。删除 Sandbox 是破坏性操作,使用 --force 前请先检查运行中的进程。