Skip to content

Commit 376f4bb

Browse files
committed
Add env var gotcha to start command docs
Environment variables passed at Sandbox.create() time are not available to the start command process since it already ran during template build. This is a common source of confusion for users coming from Docker.
1 parent 7b7dd96 commit 376f4bb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

docs/template/start-ready-command.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ This is how you get servers, seeded databases, or any long-running process avail
1212

1313
<Note title="The start command does not run on sandbox creation">
1414
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()`.
1517
</Note>
1618

1719
You can see the full build process [here](/docs/template/how-it-works).

0 commit comments

Comments
 (0)