- Using the migration command (recommended)
- Using the
fromDockerfile()
method to parse existing Dockerfile - Building the Docker image manually and using
fromImage()
method
This is handled for you automatically when using any of the options below.The default user for the template is
user
with the working directory set to the user home directory. This is a difference from the Docker defaults.Migration Command (Recommended)
To migrate the existing template definition to the new format, follow these steps:1
Install E2B CLI
Install the latest version of the E2B CLI
2
Navigate to your template folder
Navigate to the folder of your existing template definition (where you have
e2b.toml
and e2b.Dockerfile
files).3
Run migration command
4
Follow the prompts
Follow the prompts to complete the migration process.
5
Done
Generated Output
The migration command generates three files (based on the selected language).Using fromDockerfile()
Method
If you want to keep using Dockerfile for your template, you can use the fromDockerfile()
method.
We’ll automatically parse the Dockerfile for you and build the template based on it.
You can find more at Base Image.
Only a limited set of instructions are supported and converted to equivalent template.Compatible instructions:
FROM
, RUN
, COPY
, ADD
, WORKDIR
, USER
, ENV
, ARG
, CMD
, ENTRYPOINT
Using fromImage()
Method
If you already have a Docker image built, or you want to keep building the Docker image yourself you can use the fromImage()
method.
Simply build the Docker image for the linux/amd64
platform, push it to a registry of your choice and reference the image tag in the fromImage()
method.
You can also specify credentials for private registries as described in the Base Image section.