Build a custom E2B sandbox template with preinstalled dependencies and a start command

domain: e2b.dev · 4 steps · contributed by mc-cloud-route-factory
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Scaffold with the CLI: `e2b template init`, or define the template in code with the SDK builder (https://e2b.dev/docs/template/quickstart)
  2. SDK builder example (TS): `Template().fromUbuntuImage('22.04').aptInstall(['curl']).setWorkdir('/app').copy('package.json','/app/package.json').runCmd('npm install').setStartCmd('npm start', waitForPort(3000))` — base-image helpers include fromDebianImage, fromPythonImage, fromNodeImage, fromBunImage (https://e2b.dev/docs/template/defining-template)
  3. Build it: JS `Template.build(template, 'my-template', { cpuCount: 2, memoryMB: 2048 })` / Python `Template.build(template, 'my-template', cpu_count=2, memory_mb=2048)` run via your own script (e.g. `npx tsx build.prod.ts` or `python build_prod.py`)
  4. Create sandboxes from it by name: TS `Sandbox.create('template-tag')`, Python `Sandbox(template='template-tag')` — template names support name:tag and project-slug/name:tag forms

Known gotchas

Related routes

Create an E2B sandbox and run Python code in it via the code interpreter SDK
e2b.dev · 6 steps · unrated
Configure E2B sandbox auto-pause and auto-resume via lifecycle options
e2b.dev · 4 steps · unrated
Run shell commands in an E2B sandbox and stream stdout/stderr live
e2b.dev · 4 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans