General overview
Every time you are building a sandbox template, we create a container based on the definition. We extract the container’s filesystem, do provisioning and configuration (e.g. installing required dependencies), run layers commands and start a sandbox. Then, these steps happen:- We take the running sandbox.
- (Only if you specified the start command, otherwise this step is skipped) Execute the start command.
- Wait for readiness (by default 20 seconds if start command is specified, otherwise immediately ready). Readiness check can be configured using ready command.
- Snapshot the sandbox and make it ready for you to spawn it with the SDK.
Snapshots are saved running sandboxes. We serialize and save the whole sandbox’s filesystem together with all the
running processes in a way that can be loaded later.This allows us to load the sandbox in a few hundred milliseconds any time later with all the processes already running
and the filesystem exactly as it was.
Default User And Workdir
The default user in the template isuser
with the /home/user
(home directory) as the working directory.
This is different from the Docker defaults, where the default user is root
with /
as the working directory. This is to help with tools installation, and to improve default security.
The last set user and workdir in the template is then persisted as a default to the sandbox execution.
Example of setting user and workdir in the template definition are below.
Requires the E2B SDK version at least 2.3.0