Documentation Index Fetch the complete documentation index at: https://e2b-added-local-dev-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
You can test Templates locally by converting them to a Docker-compatible container images that you can build and run locally.
E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of methods are supported and converted to equivalent Docker instructions. See Compatibility for more details.
Example
Create a template file:
import { Template } from "e2b" ;
export const template = Template ()
. fromBaseImage ()
. setEnvs ({
HELLO: "Hello, World!" ,
})
. runCmd ( "echo $HELLO" )
Then, create a conversion script to convert the template to a Dockerfile definition:
import fs from "fs" ;
import { Template } from "e2b" ;
import { template } from "./template" ;
fs . writeFileSync ( "Dockerfile" , Template . toDockerfile ( template ));
Run the conversion script, forwarding the output to a new Dockerfile file:
Should produce a Dockerfile in the current directory with the following content:
FROM e2bdev/base
ENV HELLO= "Hello, World!"
RUN echo $HELLO
Build a container image from the Dockerfile and run it locally:
docker build -t template .
docker run template
Compatibility
Method Supported Docker Equivalent fromBaseImage()FROM e2bdev/basefromUbuntuImage()FROM ubuntu:versionfromNodeImage()FROM node:versionfromPythonImage()FROM python:versionfromDebianImage()FROM debian:versionfromImage()FROM custom-imagesetEnvs()ENV key=valuerunCmd()RUN commandsetStartCmd()ENTRYPOINT commandsetWorkdir()WORKDIR pathsetUser()USER usercopy()COPY src destaptInstall()RUN apt-get update && apt-get install -y packagepipInstall()RUN pip install packagenpmInstall()RUN npm install packagegitClone()RUN git clone repositorymakeSymlink()RUN ln -s src destfromTemplate()Not supported - templates based on other templates cannot be converted to Dockerfile fromDockerfile()Not supported - parsing Dockerfiles is not supported for local development fromRegistry()Not supported - registry authentication not supported for local development fromAWSRegistry()Not supported - AWS registry authentication not supported for local development fromGCPRegistry()Not supported - GCP registry authentication not supported for local development skipCache()Not supported - cache invalidation is not applicable for Dockerfile conversion setReadyCmd()Not supported - ready commands are E2B-specific and not part of Docker
Method Supported Docker Equivalent from_base_image()FROM e2bdev/basefrom_ubuntu_image()FROM ubuntu:versionfrom_node_image()FROM node:versionfrom_python_image()FROM python:versionfrom_debian_image()FROM debian:versionfrom_image()FROM custom-imageset_envs()ENV key=valuerun_cmd()RUN commandset_start_cmd()ENTRYPOINT commandset_workdir()WORKDIR pathset_user()USER usercopy()COPY src destapt_install()RUN apt-get update && apt-get install -y packagepip_install()RUN pip install packagenpm_install()RUN npm install packagegit_clone()RUN git clone repositorymake_symlink()RUN ln -s src destfrom_template()Not supported - templates based on other templates cannot be converted to Dockerfile from_dockerfile()Not supported - parsing Dockerfiles is not supported for local development from_registry()Not supported - registry authentication not supported for local development from_aws_registry()Not supported - AWS registry authentication not supported for local development from_gcp_registry()Not supported - GCP registry authentication not supported for local development skip_cache()Not supported - cache invalidation is not applicable for Dockerfile conversion set_ready_cmd()Not supported - ready commands are E2B-specific and not part of Docker