简体中文
e2b.Dockerfile
export E2B_DOMAIN=sandbox.ppio.cn e2b template init
# 本文档示例使用这个基础镜像,请保持不变 FROM e2bdev/code-interpreter:latest # 安装一些 python 包 RUN pip install cowsay
-c
export E2B_DOMAIN=sandbox.ppio.cn e2b template build -c "/root/.jupyter/start-up.sh"
import { sandbox } from '@e2b/code-interpreter' // 在上一步创建的模板 ID const templateID = 'id-of-your-template' // 将模板 ID 传递给 `Sandbox.create` 方法 const sandbox = await Sandbox.create(templateID) // 模板已安装 cowsay,可以直接使用它 const execution = await sandbox.runCode(` import cowsay cowsay.say('Hello from E2B!') `) console.log(execution.stdout)