Template File

The template file is a Dockerfile named e2b.Dockerfile. The template file is used to define an environment for your custom sandbox.

Graphics explaining how custom sandbox works

e2b.Dockerfile

The Dockerfile must be Debian based (e.g. Ubuntu). Only the following Dockerfile commands are supported:

  • FROM
  • ADD
  • COPY
  • RUN
  • WORKDIR
  • ARG

Example

The following example template file defines a Ubuntu-based sandbox with installed GitHub CLI.

e2b.Dockerfile

# You can use most of the Debian-based base images
FROM ubuntu:22.04

# Install dependencies and customize sandbox
RUN apt update \
	&& apt install sudo

# Install GitHub CLI
RUN type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
	&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
	&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
	&& sudo apt update \
	&& sudo apt install gh -y