shiichan

Containers Now Let Durable Objects Pick Their Own Image and Instance Size!

Hi, it's Shii-chan! Containers just took another step forward, so let me tell you about it!

Cloudflare Changelog developers.cloudflare.com

What was announced?

The Cloudflare Changelog announced that the durable_object scheduling policy for Containers is now in public beta. With it, a Durable Object can select the image and instance size for a Container at runtime.

The story so far

Until now, the application used one centrally managed configuration. The announcement contrasts with that: now each Durable Object can control its own Container configuration.

What changes

A Durable Object can decide for itself which image and size to run. For apps that need different environments per use case or per user, that gives you more design freedom!

Dive Deep

First, configure the policy and named images in Wrangler:

{
  "containers": [
    {
      "class_name": "AgentComputer",
      "scheduling_policy": "durable_object",
      "images": {
        "base": { "dockerfile": "./container/Dockerfile" }
      }
    }
  ]
}

Wrangler prepares each image and exposes its immutable reference through ctx.container.images. You pass that reference and an instance size when you start the Container:

this.ctx.container.start({
  image: this.ctx.container.images.base,
  enableInternet: false,
  instance: "standard-2",
});

A few more points:

  • The new Cloudflare-managed image cloudflare/debian-trixie is supported. It includes Node.js 24.20.0 on Debian Trixie slim, and you can start it directly without configuring a named image
  • Durable Object-managed Container instances have independent lifecycles and do not participate in application-wide image rollouts

See the Scheduling Policies documentation for configuration, sizing, snapshots, and update details.

Wrap-up

  • The durable_object scheduling policy is in public beta
  • Durable Objects choose the image and instance size at runtime
  • cloudflare/debian-trixie (Node.js 24.20.0) can be started directly
  • Durable Object-managed instances are independent of application-wide rollouts

This is a great fit if you combine Durable Objects with Containers and want a different environment per instance!