目标读者: MXC 使用者
这些示例演示了 Rust、.NET 和 Node 中受支持的 V1 SDK 接口。它们按场景组织,以便于比较等效操作,同时每种实现仍保持其语言的惯用风格。
.NET 示例面向 net10.0,需要 .NET 10 SDK。它们的项目引用还会构建原生 SDK,因此请安装由 src/rust-toolchain.toml 选定的 Rust 工具链。
| 场景 | 用途 | Rust | .NET | Node |
|---|---|---|---|---|
| 在持久化容器中运行 | 配置、启动、执行、停止和取消配置 | run-in-persisted-container/rust | run-in-persisted-container/dotnet | run-in-persisted-container/node |
| 在临时容器中运行 | 构建并执行一个完整的运行至完成请求 | run-in-transient-container/rust | run-in-transient-container/dotnet | run-in-transient-container/node |
| 带文件系统隔离运行 | 授予一个主机目录只读权限 | run-with-containment-of-filesystem/rust | run-with-containment-of-filesystem/dotnet | run-with-containment-of-filesystem/node |
| 带网络隔离运行 | 拒绝出站、入站和主机回环网络 | run-with-containment-of-network/rust | run-with-containment-of-network/dotnet | run-with-containment-of-network/node |
| 带日志记录访问拒绝运行 | 捕获被阻止的 ProcessContainer 访问 | run-with-logging-access-denied/rust | run-with-logging-access-denied/dotnet | run-with-logging-access-denied/node |
| 带捕获 I/O 运行 | 在退出后返回完整的 stdout 和 stderr | run-with-io-captured/rust | run-with-io-captured/dotnet | run-with-io-captured/node |
| 带交互式 PTY I/O 运行 | 转发交互式终端 | run-with-io-pty-interactive/rust | run-with-io-pty-interactive/dotnet | run-with-io-pty-interactive/node |
| 带流式标准 I/O 运行 | 实时流式传输 stdout 和 stderr | run-with-io-stdio-streaming/rust | run-with-io-stdio-streaming/dotnet | run-with-io-stdio-streaming/node |
| 带遥测运行 | 请求同意,然后将一次临时运行选择加入遥测 | run-with-telemetry/rust | run-with-telemetry/dotnet | run-with-telemetry/node |
| 检查隔离支持 | 在不启动容器的情况下发现支持情况 | dryrun-check-containment-support/rust | dryrun-check-containment-support/dotnet | dryrun-check-containment-support/node |
运行示例需要受支持且已准备就绪的主机。有关平台特定的先决条件,请参阅 docs/ 下适用的后端指南。