containers: Add documentation for the newly added container.exec()
Summary
We are adding a new set of docs for the newly added container.exec() method under the Durable Object Containers umbrella.
Screenshots (optional)
Documentation checklist
- [x] Is there a changelog entry (guidelines)? If you don't add one for something awesome and new (however small) — how will our customers find out? Changelogs are automatically posted to RSS feeds, the Discord, and X.
- [ ] The change adheres to the documentation style guide.
- [ ] If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
- [ ] Files which have changed name or location have been allocated redirects.
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
| Pattern | Owners |
|---|---|
/src/content/changelog/ |
@cloudflare/pm-changelogs, @cloudflare/product-owners |
/src/content/docs/containers/ |
@mikenomitch, @th0m, @cloudflare/product-owners, @cloudflare/cloudchamber |
/src/content/docs/durable-objects/ |
@elithrar, @rita3ko, @irvinebroque, @vy-ton, @iglesiasbrandon, @joshthoward, @danlapid, @oxyjun, @lambrospetrou, @mikenomitch, @cloudflare/product-owners |
PR Review for #31565
Summary
This PR adds documentation for the new container.exec() API under the Durable Object Containers product:
- Changelog entry (
changelog/containers/2026-06-18-container-exec.mdx) announcing the feature with a short example. - New how-to page (
containers/execute-commands.mdx) covering startup, streaming stdin/stdout/stderr, process context, combined output, nonzero exits, large output streaming, timeouts, and coordinating multiple exec calls. - Container class reference update (
containers/container-class.mdx) adding an "Execute commands" section that links to the new how-to page. - Durable Object Container API reference update (
durable-objects/api/container.mdx) adding a fullexec()method reference with parameters, return types, and exceptions.
Validation Results
pnpm run check✅ (0 errors, 0 warnings from changed files)pnpm run format:core:check✅
Suggested Labels
documentation, containers, durable-objects
Issues Flagged
1. Changelog code example uses mixed indentation
File: src/content/changelog/containers/2026-06-18-container-exec.mdx
Lines 25–33 use a mix of spaces and tabs. The rest of the repository (and the earlier lines in this example) uses tabs.
Suggested fix:
async runDiagnostics() {
if (!this.ctx.container.running) {
await this.start();
}
const process = await this.ctx.container.exec(["node", "--version"]);
const output = await process.output();
return {
exitCode: output.exitCode,
stdout: new TextDecoder().decode(output.stdout),
stderr: new TextDecoder().decode(output.stderr),
};
}
2. start() invoking onStart() on already-running containers
File: src/content/docs/durable-objects/api/container.mdx (line 89) and src/content/docs/containers/execute-commands.mdx (line 15)
"Calling
start()invokesonStart(), including when the Container is already running..."
This behavior is surprising and is not documented in the start() method reference on the Container class page. If this is accurate, the container-class.mdx page should also be updated. If it is not accurate, this sentence should be corrected.
Action needed: Verify this behavior with engineering and align docs across both pages.
3. Missing reviewed date on new page
File: src/content/docs/containers/execute-commands.mdx
New pages should include a reviewed frontmatter field per the docs conventions.
Suggested fix: Add to frontmatter:
reviewed: 2026-06-18
4. Vague user option description
File: src/content/docs/containers/execute-commands.mdx (line 264)
"The
useroption passes a user identifier to the Container runtime. The identifier must be valid for the image and runtime."
"Valid for the image and runtime" is unclear to readers. Does this accept a username, a UID, or both?
Suggested fix: Clarify the expected format, for example:
"The
useroption passes a user identifier (user name or numeric UID) to the Container runtime. The value must exist in the container image's/etc/passwdfile."
5. PR checklist
The documentation checklist has the style-guide item unchecked. Please review the items above and check the box once addressed (or confirm no content/redirect issues apply).
General Feedback
- The how-to page is well-structured and includes practical, real-world patterns (RPC streaming, backpressure, batching commands).
- Internal links are correct and point to the right pages.
- Frontmatter schemas are valid.
- Changelog entry is appropriately concise and links to the new guide.
Overall: Looks solid—just needs the indentation fix, the reviewed date, and clarification on the start()/onStart() behavior before merging.
github run
Preview URL: https://aeda2298.preview.developers.cloudflare.com Preview Branch URL: https://docs-container-exec.preview.developers.cloudflare.com
Files with changes (up to 15)
Review
💡 3 suggestions found in full PR diff. ⚠️ Part of the review could not complete and will retry on the next push.
Code Review
This code review is in beta and may not always be helpful — use your judgment.
❌ This review could not complete this run; results may be incomplete. It will retry on the next push.
Style Guide Review
Suggestions (3)
| File | Issue |
|---|---|
durable-objects/api/container.mdx line 98 |
Oxford comma — List uses pipes, redirects, expansion, or other shell syntax without a serial comma. Fix: Add a comma before or: pipes, redirects, expansion, or other shell syntax → pipes, redirects, expansion, or other shell syntax. |
durable-objects/api/container.mdx line 131 |
Oxford comma — Sentence uses captures, discards, or merges without a serial comma. Fix: Add a comma before or: captures, discards, or merges → captures, discards, or merges. |
durable-objects/api/container.mdx line 159 |
Oxford comma — List uses is empty, an option mode is invalid, or ... (three items) without a serial comma. Fix: Add a comma before or: is empty, an option mode is invalid, or ... → is empty, an option mode is invalid, or .... |
Commands
Only codeowners can run commands. Post a comment with the command to trigger it.
| Command | Description |
|---|---|
/review |
Runs a review now. Incremental if a prior review exists, full if not. |
/full-review |
Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist. |
/fan-out-review |
Forces a full review using the per-file fan-out mode regardless of diff size. Each file is reviewed in its own session for maximum per-file detail. ⚠️ This may take a very long time on large PRs and may fail or time out — use only when you want the most thorough review and are willing to wait. |
/holistic-review |
Forces a full review using the holistic mode regardless of diff size. The entire diff is reviewed in one pass, enabling cross-file reasoning. Faster and more reliable on large PRs. |
/ignore-review-limit |
Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal. |
Pushed suggestions by the bot
/full-review