> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 启动命令

export const SandboxCliConfigHint = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    return <Note>在运行本文档中命令行相关的示例代码前，请参考 <Link href="/sandbox/cli">教程</Link> 来进行安装 PPIO 沙箱命令行工具，并完成  <Link href="/sandbox/cli-auth">认证</Link>。</Note>;
  }
};

在构建沙箱模板过程中，会执行启动命令，并且通过对命令运行结果进行快照，基于该快照启动沙箱时，能做到极低的用户等待时间（约 200ms），并在您生成沙箱时为用户准备好一切。详情请参考 <Link href="/sandbox/sandbox-template#工作原理">工作原理</Link>。

<SandboxCliConfigHint />

## 如何添加启动命令

在构建沙箱模板时，您可以使用 `-c` 选项指定启动命令：

```bash Bash icon="terminal" theme={null}
ppio-sandbox-cli template build -c "<your-start-command>"
```

### 通过配置文件

您也可以在运行 `ppio-sandbox-cli template build` 命令的同一目录下的 `ppio.toml` 文件内指定启动命令。

```toml Toml icon="gear" theme={null}
template_id = "0r0efkbfwzfp9p7qpc1c"
dockerfile = "ppio.Dockerfile"
template_name = "my-agent-sandbox"
start_cmd = "<your-start-command>"
```

## 日志

您可以使用命令行工具查询沙箱启动命令的日志：

```bash Bash icon="terminal" theme={null}
ppio-sandbox-cli sandbox logs <sandbox-id>
```
