Skip to content

Commit eea345c

Browse files
authored
Merge branch 'main' into add-api-ref-to-nav
2 parents f363431 + ed03806 commit eea345c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

docs/template/quickstart.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description: "Start with custom sandbox templates"
55

66
E2B templates allow you to define custom sandboxes.
77
You can define the base image, environment variables, files to copy, commands to run, and
8-
a start command that will be already running when you spawn the sandbox.
9-
This way, you can have fully configured sandboxes with running processes ready to use with zero wait time for your users.
8+
a [start command](/docs/template/start-ready-command#start-command) that runs during the template build and is captured in a snapshot — so the process is **already running** when you create a sandbox from that template.
9+
This gives you fully configured sandboxes with running processes ready to use with zero wait time for your users.
1010

1111
There are two ways how you can start creating a new template:
1212
- using the CLI

docs/template/start-ready-command.mdx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ description: "Define running processes for the sandbox"
44
---
55

66
## Start command
7-
The start command allows you to specify a command that will be **already running** when you spawn your custom sandbox.
8-
This way, you can for example have running servers or seeded databases inside the sandbox that are already fully ready when you spawn the sandbox using the SDK and with zero waiting time for your users during the runtime.
7+
The start command lets you specify a process that runs at the **end of the template build** — not when a sandbox is created.
8+
During the build, E2B executes the start command, waits for the [ready command](#ready-command) to confirm the process is up, and then takes a [snapshot](/docs/template/how-it-works) of the entire sandbox including the running process.
99

10-
The idea behind the start command feature is to lower the wait times for your users and have everything ready for your users when you spawn your sandbox.
10+
When you later create a sandbox from that template, the snapshotted process is **already running** — there is no startup wait.
11+
This is how you get servers, seeded databases, or any long-running process available instantly when spawning sandboxes with the SDK.
1112

12-
You can see how it works [here](/docs/template/how-it-works).
13+
<Note title="The start command does not run on sandbox creation">
14+
The start command runs **once during template build** and is captured in a snapshot. It does not re-execute each time you create a sandbox. If you need to run a command every time a sandbox is created, use `sandbox.commands.run()` after creating the sandbox instead.
15+
16+
This also means that [environment variables passed to `Sandbox.create()`](/docs/sandbox/environment-variables#1-global-environment-variables) are **not available** to the start command process — it already ran during the build. If your start command needs environment variables, set them in the template definition using `setEnvs()` / `set_envs()`.
17+
</Note>
18+
19+
You can see the full build process [here](/docs/template/how-it-works).
1320

1421
## Ready command
1522
The ready command allows you to specify a command that will determine **template sandbox** readiness before a [snapshot](/docs/template/how-it-works) is created.
@@ -18,7 +25,7 @@ This way you can control how long should we wait for the [start command](/docs/t
1825

1926
## Usage
2027

21-
Set the command that runs when the sandbox starts and the command that determines when the sandbox is ready:
28+
Set the start command (executed during template build) and the ready command (determines when the process is up before snapshotting):
2229

2330
<CodeGroup>
2431

0 commit comments

Comments
 (0)