Create a custom sandbox
Use this option if you know beforehand what packages you need in the sandbox. Prerequisites:- E2B CLI
- Docker running
Custom sandbox template is a Docker image that we automatically convert to a sandbox that you can then start with our SDK.
1. Install E2B CLI
Using Homebrew (on macOS)2. Login to E2B CLI
Before you can create a custom sandbox, you need to login to E2B CLI.2. Initialize a sandbox template
3. Specify the packages you need in e2b.Dockerfile
Edit the E2B Dockerfile to install the packages you need.
You need to use the
e2bdev/code-interpreter:latest
base image.4. Build the sandbox template
Run the following command to build the sandbox template.5. Start your custom sandbox
Now you can pass the template ID to the SDK to start your custom sandbox.Install packages during the sandbox runtime
Use this option if don’t know beforehand what packages you need in the sandbox. You can install packages with the package manager of your choice.The packages installed during the runtime are available only in the running sandbox instance.
When you start a new sandbox instance, the packages are not be available.
1. Install Python packages with PIP
2. Install Node.js packages with NPM
3. Install packages with package manager of your choice
Since E2B Sandboxes are Debian based machines, you can use any package manager supported by Debian. You just need to make sure that the package manager is already installed in the sandbox. For example, to installcurl
and git
, you can use the following commands: