Creating template
When creating a template, you can specify options:.dockerignore files and combines them with your fileIgnorePatterns (TypeScript) or file_ignore_patterns (Python). Files matching these patterns are excluded from uploads and hash calculations.
Defining base image
Every template starts with a base image that provides the foundation for your sandbox environment.Predefined base images
Use convenience methods for common base images with Ubuntu, Debian, Python, Node.js, or Bun:Custom base image
Use any Docker image from Docker Hub or other registries:Default E2B base image
Use the default E2B base image, which comes pre-configured for sandbox environments:base is also the template used when you call Sandbox.create() without specifying one. It is Debian-based and comes with common tooling pre-installed: Python 3, Node.js, Yarn, git, curl, build-essential, and the GitHub CLI (gh). For the exact contents, see the public Dockerfile: templates/base/e2b.Dockerfile.
Default resources
A sandbox gets its CPU and memory from the template it’s built on. A sandbox built frombase starts with 2 vCPU and 512 MiB of RAM.
You can override CPU and memory when you build a template (cpuCount/cpu_count, memoryMB/memory_mb). Disk size is not a default you set per sandbox; it’s determined by your team’s tier limit and applied at build time (see Build limits).
Build from existing template
Extend an existing template from your team or organization:You can only call base image methods once per template. Subsequent calls will throw an error.
Parsing existing Dockerfiles
Convert existing Dockerfiles to template format usingfromDockerfile():