diff --git a/src/content/docs/containers/api/durable-object-container.mdx b/src/content/docs/containers/api/durable-object-container.mdx index eee3b721065..22c30e0f07e 100644 --- a/src/content/docs/containers/api/durable-object-container.mdx +++ b/src/content/docs/containers/api/durable-object-container.mdx @@ -103,7 +103,7 @@ this.ctx.container.start({ #### Parameters - `options` (`object`, conditionally required): Startup options. Required for applications that use the `durable_object` scheduling policy and optional for applications that use the `default` scheduling policy. - - `env` (`Record`, optional): Environment variables to pass to the container. Processes started with [`exec()`](#exec) do not receive these variables, except `PATH`. + - `env` (`Record`, optional): Environment variables to pass to the container. Each variable can use up to 16,000 UTF-8 bytes for its name and value combined. Refer to [Environment variable limits](/containers/platform/limits/#environment-variable-limits) for the total limit. Processes that you start with [`exec()`](#exec) do not receive these variables, except `PATH`. - `entrypoint` (`string[]`, optional): Command and arguments to run in the container. - `enableInternet` (`boolean`, optional): Whether to allow outbound Internet access. Defaults to `false`. - `image` (`string`, conditionally required) : Image reference to start. Required unless you pass `containerSnapshot`. Pass the [`cloudflare/debian-trixie` managed image](/containers/guides/image-management/#use-the-cloudflare-managed-image) or a value from [`ctx.container.images`](#images). @@ -124,6 +124,8 @@ this.ctx.container.start({ - `start()` throws a `RangeError` when a custom `instance` value is missing or invalid. - `start()` throws an `Error` when `labels` exceed the label limits, when an environment variable name contains `=`, or when an environment variable name or value contains a null character. +If `env` exceeds the per-variable or total size limit, the container fails to start and [`monitor()`](#monitor) rejects. + ### `inspect` `inspect()` returns the image and labels for a running container. It returns `null` when no container is running. diff --git a/src/content/docs/containers/platform/limits.mdx b/src/content/docs/containers/platform/limits.mdx index 6055705373f..3cb639e89e6 100644 --- a/src/content/docs/containers/platform/limits.mdx +++ b/src/content/docs/containers/platform/limits.mdx @@ -61,6 +61,19 @@ The following limits apply per account: [^1]: Delete a tagged container image with [`wrangler containers images delete IMAGE:TAG`](/workers/wrangler/commands/containers/#containers-images-delete) to free up space. If you delete a container image and then [roll back](/workers/versions-and-deployments/rollbacks/) your Worker to a previous version, this version may no longer work. +## Environment variable limits + +The following limits apply to variables you pass in the `env` option of [`ctx.container.start()`](/containers/api/durable-object-container/#start): + +| Scope | Limit | +| ------------------------- | ------------- | +| Each environment variable | 16,000 bytes | +| All environment variables | 640,000 bytes | + +To calculate a variable's size, add the UTF-8 byte lengths of its name and value. Do not count the `=` separator. The total is the sum of those sizes. + +For larger payloads, pass an identifier in `env`. Send the payload to the running container through [standard input with `exec()`](/containers/guides/execute-commands/#send-standard-input). + ## Outbound HTTP request body size Cloudflare limits each HTTP request body forwarded from a Container to an external service through an [outbound handler](/containers/configuration/outbound-traffic/) to **100 MiB by default**.