Skip to content

Some minor tweaks#23150

Merged
mikenomitch merged 11 commits intoproductionfrom
mikenomitch/add-containers-docs
Jun 24, 2025
Merged

Some minor tweaks#23150
mikenomitch merged 11 commits intoproductionfrom
mikenomitch/add-containers-docs

Conversation

@mikenomitch
Copy link
Contributor

Summary

Adds documentation for an upcoming feature 🤫 🤐 🙈

Documentation checklist

  • The documentation style guide has been adhered to.
  • 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.

@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
* @cloudflare/pcx-technical-writing
/src/content/docs/durable-objects/ @elithrar, @vy-ton, @joshthoward, @oxyjun, @harshil1712, @mikenomitch, @cloudflare/pcx-technical-writing, @cloudflare/workers-runtime-1
/src/content/docs/workers/wrangler/ @cloudflare/wrangler, @irvinebroque, @kodster28, @cloudflare/pcx-technical-writing, @cloudflare/workers-runtime-1
/src/content/partials/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @kodster28, @cloudflare/wrangler, @cloudflare/workers-runtime-1, @cloudflare/wrangler

@mikenomitch mikenomitch force-pushed the mikenomitch/add-containers-docs branch from 7df8b01 to 3954f36 Compare June 21, 2025 18:22
mikenomitch and others added 2 commits June 24, 2025 04:53
Various small fixes

Co-authored-by: Nikita Sharma <54369599+nikitassharma@users.noreply.github.com>
Copy link
Contributor

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ copy suggestions for homepage, can take or leave

Co-authored-by: Brendan Irvine-Broque <birvine-broque@cloudflare.com>
Copy link
Contributor

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Notes on getting started docs

```

- Making requests to `/lb` will load balance requests across several containers.
This uses a simple `getRandom` helper method currently, which picks an ID at random
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This uses a simple `getRandom` helper method currently, which picks an ID at random
This uses a simple `getRandom` helper method, which picks an ID at random


- Making requests to `/lb` will load balance requests across several containers.
This uses a simple `getRandom` helper method currently, which picks an ID at random
from a set number (in this case 3), then routes to that Container instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from a set number (in this case 3), then routes to that Container instance.
from a set number (in this case 3), then routes to that Container instance. You can replace this with any routing or load balancing logic you choose to implement:

(or maybe there is a good example we want to point towards)

Currently, routing requests to one of many interchangeable Container instances is accomplished
with the `getRandom` helper.

This is a temporary solution until first-party support for utilization-aware autoscaling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is a temporary solution until first-party support for utilization-aware autoscaling
This is temporary — we plan to add native support for latency-aware autoscaling and load balancing in the coming months.

with the `getRandom` helper.

This is a temporary solution until first-party support for utilization-aware autoscaling
and latency-aware load balancing is added to Cloudflare Containers. We plan to add this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and latency-aware load balancing is added to Cloudflare Containers. We plan to add this


This is a temporary solution until first-party support for utilization-aware autoscaling
and latency-aware load balancing is added to Cloudflare Containers. We plan to add this
in the coming months.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in the coming months.

Copy link
Contributor

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ re: Platform section

@@ -0,0 +1,71 @@
---
pcx_content_type: navigation
title: Platform Details
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Platform Details
title: Platform

consistent with rest of docs


import { WranglerConfig } from "~/components";

This page containers general details about the Containers platform.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This page containers general details about the Containers platform.

## Instance Types

The memory, vCPU, and disk space for Containers are set through predefined instance types.
There are currently three instance types available for Containers users by default:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There are currently three instance types available for Containers users by default:
Three instance types are currently available:

| basic | 1 GiB | 1/4 | 4 GB |
| standard | 4 GiB | 1/2 | 4 GB |

These are specified using the `instance_type` property in wrangler config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These are specified using the `instance_type` property in wrangler config.
These are specified using the [`instance_type` property](/workers/wrangler/configuration/#containers) in your Worker's Wrangler configuration file. Looking for larger instances? [Give us feedback here](/containers/beta-info/#feedback-wanted) and tell us what size instances you need, and what you want to use them for.


## Limits

Containers limits are currently set per account. You may have higher
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Containers limits are currently set per account. You may have higher


| Feature | Workers Paid |
| ------------------------------------------------- | ------------ |
| GB Memory for concurrent live Container instances | 40GB [^1] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| GB Memory for concurrent live Container instances | 40GB [^1] |
| GB Memory for all concurrent live Container instances | 40GB [^1] |

| Feature | Workers Paid |
| ------------------------------------------------- | ------------ |
| GB Memory for concurrent live Container instances | 40GB [^1] |
| vCPU for concurrent live Container instances | 20 [^1] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| vCPU for concurrent live Container instances | 20 [^1] |
| vCPU for all concurrent live Container instances | 20 [^1] |

| ------------------------------------------------- | ------------ |
| GB Memory for concurrent live Container instances | 40GB [^1] |
| vCPU for concurrent live Container instances | 20 [^1] |
| GB Disk for concurrent live Container instances | 100GB [^1] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| GB Disk for concurrent live Container instances | 100GB [^1] |
| GB Disk for all concurrent live Container instances | 100GB [^1] |

| vCPU for concurrent live Container instances | 20 [^1] |
| GB Disk for concurrent live Container instances | 100GB [^1] |
| Image size | 2 GB |
| Total image storage for account | 50 GB [^2] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Total image storage for account | 50 GB [^2] |
| Total image storage per account | 50 GB [^2] |


[^1]: This limit will be raised as we continue the beta.

[^2]: Delete images with `wrangler containers delete` to free up space. Note that reverted Workers may then break.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[^2]: Delete images with `wrangler containers delete` to free up space. Note that reverted Workers may then break.
[^2]: Delete container images with `wrangler containers delete` to free up space. Note that if you delete a container image and then [roll back](/workers/configuration/versions-and-deployments/rollbacks/) your Worker to a previous version, this version may no longer work.

I'm actually not sure I could fully explain this given how we say this?

Screenshot 2025-06-23 at 11 18 25 PM

Copy link
Contributor

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ local dev

@@ -0,0 +1,47 @@
---
pcx_content_type: reference
title: Local Dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Local Dev
title: Local Development

order: 3
---

## Local Development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like something in getting started should reference?

order: 3
---

## Local Development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Local Development
Screenshot 2025-06-23 at 11 20 29 PM

Already has title above?

`wrangler dev` or `wrangler deploy`.

:::note
If your Worker app creates many container instances, you may hit local limits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If your Worker app creates many container instances, you may hit local limits
If your Worker app creates many container instances, your local machine may not be able to run as many containers concurrently as is possible when you deploy to Cloudflare.

Suggest being clear that this isn't a limitation of the product but a limit of the end developer's machine that we are talking about here?


:::note
If your Worker app creates many container instances, you may hit local limits
on concurrent containers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on concurrent containers.


## Iterating on Container code

When using `wrangler dev`, standard Worker code is automatically reloaded by wrangler you save a change,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When using `wrangler dev`, standard Worker code is automatically reloaded by wrangler you save a change,
When you use `wrangler dev`, your Worker's code is automatically reloaded by Wrangler each time you save a change,

When using `wrangler dev`, standard Worker code is automatically reloaded by wrangler you save a change,
but code running within the container is not.

If you wish to rebuild your container with new code changes, you can hit the `[r]` key on your keyboard, and a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you wish to rebuild your container with new code changes, you can hit the `[r]` key on your keyboard, and a
To rebuild your container with new code changes, you can hit the `[r]` key on your keyboard, which

but code running within the container is not.

If you wish to rebuild your container with new code changes, you can hit the `[r]` key on your keyboard, and a
rebuild will be triggered. Instances will be restarted with the new images.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rebuild will be triggered. Instances will be restarted with the new images.
triggers a rebuild. Container instances will then be restarted with the newly built images.

If you wish to rebuild your container with new code changes, you can hit the `[r]` key on your keyboard, and a
rebuild will be triggered. Instances will be restarted with the new images.

You may prefer to set up your code watchers and reloading mechanisms, or mount a local directory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You may prefer to set up your code watchers and reloading mechanisms, or mount a local directory
You may prefer to set up your own code watchers and reloading mechanisms, or mount a local directory


```js
if (pathname.startsWith("/container")) {
let id = env.MY_CONTAINER.idFromName("container");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realizing that nothing in this page or elsewhere in docs links to or explains bindings


## Using existing images

If you wish to use a pre-built image, first, push it to the Cloudflare Registry:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be louder here about public/private nature of the registry?

You can run both your container and your Worker locally, without additional configuration, by running [`npx wrangler dev`](/workers/wrangler/commands/#dev) in your project's directory.

To develop Container-enabled Workers locally, you will need to first ensure that a
Docker compatible CLI tool is installed. For instance, you can use [Docker Desktop](https://docs.docker.com/desktop/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Docker compatible CLI tool is installed. For instance, you can use [Docker Desktop](https://docs.docker.com/desktop/)
Docker compatible CLI tool and engine is installed. For instance, you can use [Docker Desktop](https://docs.docker.com/desktop/)

users will also have to configure the docker host if its not docker desktop.
hopefully by this afternoon, they can do WRANGLER_DOCKER_HOST="unix:///Users/myUser/.colima/default/docker.sock" etc, or set that field in their wrangler config under dev.container_engine.
if we haven't got the release out yet, users can symlink the default docker socket e.g. sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock

probably mention the symlink thing and i can put up an update PR to the docs when the wrangler release is out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we also want to mention you have to expose any ports you call in your dockerfile?

Copy link

@gabivlj gabivlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(some minor comments)


### Reduction of log noise

Currently, the `Container` class uses Durable Object alarms to help manage Container shutdown. This
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative for the user, if they need bigger control over their alarms, they can choose to use the ctx.container directly on a DurableObject?

When using a [Container-enabled Durable Object](/containers), you can access the Durable Object's associated container via
the `container` object which is on the `ctx` property. This allows you to start, stop, and interact with the container.

:::note
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to tell the user when is it preferable to use one or the other.

@mikenomitch mikenomitch merged commit cc5260a into production Jun 24, 2025
10 checks passed
@mikenomitch mikenomitch deleted the mikenomitch/add-containers-docs branch June 24, 2025 15:02
sdnts pushed a commit to sdnts/cloudflare-docs that referenced this pull request Jul 24, 2025
* Adds Containers docs

* A variety of tweaks to containers docs

* Fixes bad links

* replace icon

* remove extra file

* Apply suggestions from code review

Various small fixes

Co-authored-by: Nikita Sharma <54369599+nikitassharma@users.noreply.github.com>

* Removes unnecessary pre-req and wrong TCP statement

* Apply suggestions from code review

Co-authored-by: Brendan Irvine-Broque <birvine-broque@cloudflare.com>

* Apply suggestions from code review

* Update pricing docs, make sure to clarify what is part of Workers Paid plan

* Various tweaks

---------

Co-authored-by: kodster28 <kody@cloudflare.com>
Co-authored-by: Nikita Sharma <54369599+nikitassharma@users.noreply.github.com>
Co-authored-by: Brendan Irvine-Broque <birvine-broque@cloudflare.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:containers product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ product:workers Related to Workers product size/xl

Projects

None yet

Development

Successfully merging this pull request may close these issues.