Skip to content

docs: distinguish the ${WORKDIR} placeholder from the WORKSPACE_DIR variable - #26230

Open
mdelapenya wants to merge 2 commits into
docker:mainfrom
mdelapenya:fix/workspace-var-names
Open

mdelapenya wants to merge 2 commits into
docker:mainfrom
mdelapenya:fix/workspace-var-names

Conversation

@mdelapenya

Copy link
Copy Markdown
Member

Description

Kit authors mix up three names that share a word: the v2 ${WORKDIR} placeholder, the WORKSPACE_DIR environment variable, and the image's Dockerfile WORKDIR. The v2 reference only said that ${WORKDIR} "expands to the workspace path", which reads as if it were a variable, and nothing on the page said where WORKSPACE_DIR is available.

This change, on the Kits v2 page:

  • rewords the content row of setup.files so ${WORKDIR} is described as a literal replaced at creation
  • adds a short table after files naming the three things and where each applies, and states that there is no WORKDIR environment variable in the sandbox
  • notes under install that the workspace path is available as WORKSPACE_DIR

On the "Author kits" page, under "Pass environment variables to hooks", one paragraph says that v3 lifecycle files content reads variables through ${{ kit.env.NAME }} (for example ${{ kit.env.WORKSPACE_DIR }}) and that plain $VAR stays literal, since v3 has no ${WORKDIR} placeholder. That matches the public v3 kit spec.

Verified behaviour from the sbx runtime: the placeholder is replaced only in setup.files[].content; WORKSPACE_DIR is set in the container and visible to install and startup commands and to the agent.

Related issues or tickets

Reviews

  • Technical review
  • Editorial review

…ariable

Kit authors mix up three things that share a word: the v2 ${WORKDIR}
placeholder that is replaced only inside setup.files content, the
WORKSPACE_DIR environment variable the runtime sets in the container, and
the image's Dockerfile WORKDIR. Name all three where setup.files is
documented, say that WORKDIR is not an environment variable, and note that
v3 kits have no placeholder and read the variable through kit.env in
lifecycle files instead.

Refs docker/sbx-releases#570

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Manuel de la Peña <manuel.delapena@docker.com>
@mdelapenya
mdelapenya requested a review from dvdksn as a code owner September 30, 2026 15:02
@netlify

netlify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 42c38b4
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6abf9e3a1f02f40008537c3e
😎 Deploy Preview https://deploy-preview-26230--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dvdksn

dvdksn commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The distinction is useful, but the explanation needs a clearer sequence. Please lead with what authors should write in generated files versus shell commands, then explain when substitution happens.

On the v3 page, give generated files their own subsection and replace “the same variables” with “container environment variables.” kit.env reads the final container environment, independently of a hook’s env list. Replace “stay literal” with “are written unchanged, without substituting their values.”

On the v2 page, consolidate the repeated placeholder explanation, qualify the shell syntax for startup commands, and move the v3 comparison to the migration section. Also replace the absolute claim that no WORKDIR environment variable exists with the narrower explanation that Dockerfile WORKDIR does not define one.

Generated by Codex

Review feedback on the WORKDIR / WORKSPACE_DIR clarification: the pages
now open with what to write in generated files versus shell commands and
only then explain when substitution happens. The v3 page gives generated
files their own subsection, names container environment variables as what
kit.env reads, and says unsubstituted references are written unchanged.
The v2 page states the placeholder once, qualifies that shell syntax in
startup commands expands only under a shell, moves the v3 comparison to
the migration section, and narrows the WORKDIR claim to what a Dockerfile
WORKDIR does not define.

Related: docker/sbx-releases#570

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Manuel de la Peña <manuel.delapena@docker.com>
@mdelapenya

Copy link
Copy Markdown
Member Author

Thanks for the pass, all five taken in 42c38b4.

Both pages now open with what to write (${WORKDIR} in v2 content, ${{ kit.env.NAME }} in v3 files, shell syntax such as $WORKSPACE_DIR in commands) and only then say when the substitution happens. The v3 page has a "Generated files" subsection with your wording: container environment variables, kit.env reads the final container environment independently of a hook's env list, and unsubstituted references are written unchanged. I checked that against the spec's kit.env section before writing it.

On the v2 page the placeholder is stated once, the startup section says a $WORKSPACE_DIR reference in the array is passed unchanged unless the command runs through a shell, the WORKDIR claim is narrowed to what a Dockerfile WORKDIR doesn't define, and the v3 comparison moved to the "Move an environment to v3" table as a new row pointing at the new subsection.

One call you may want to check: I dropped the WORKSPACE_DIR sentence under install, since the consolidated text covers it and install already says it runs through sh -c.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants