Add a `containers` entry in wrangler config specifying `image` (a Dockerfile path, a directory containing one, or a fully-qualified image reference), `class_name` (must match a Durable Object class), and `max_instances`.
Bind the backing Durable Object: `[[durable_objects.bindings]] name = "MY_CONTAINER" class_name = "MyContainer"`, plus a migration `[[migrations]] tag = "v1" new_sqlite_classes = ["MyContainer"]`. Containers require the SQLite-backed DO path, not `new_classes`.
For stateful or session-pinned work, route to a specific instance: `const c = env.MY_CONTAINER.getByName(sessionId); return await c.fetch(request);` — the same id always reaches the same container instance.
For interchangeable stateless work, load-balance instead: `const c = await getRandom(env.MY_CONTAINER, 3); return await c.fetch(request);`.
Ensure `defaultPort` matches the port your container process actually listens on — both fetch() and containerFetch() target it.
Pick an instance_type: lite (1/16 vCPU, 256 MiB, 2 GB disk), basic (1/4 vCPU, 1 GiB, 4 GB), standard-1 (1/2 vCPU, 4 GiB, 8 GB), standard-2 (1 vCPU, 6 GiB, 12 GB), standard-3 (2 vCPU, 8 GiB, 16 GB), standard-4 (4 vCPU, 12 GiB, 20 GB). `dev` and `standard` remain aliases for lite and standard-1.
For a custom size instead of a predefined type the constraints are: 1-4 vCPU, up to 12 GiB memory, up to 20 GB disk, minimum 3 GiB memory per vCPU, and at most 2 GB disk per 1 GiB memory.
Tune `sleepAfter` (e.g. '10s', '10m') to trade cold-start latency against paying for idle warm instances.
Handle shutdown: the platform sends SIGTERM and then SIGKILL after 15 minutes. Do graceful cleanup in `onStop()` / `onActivityExpired()`.
Deploy with `wrangler deploy`. Cloudflare uploads the image to its Registry and pre-fetches it globally; the first request starts an instance at the nearest location holding a pre-fetched image, and later requests to that instance route back to that same location while it stays alive.
Budget the billing model: charged per 10 ms of actively running instance time, memory and disk billed on provisioned resources, CPU billed on active use. Workers Paid includes 25 GiB-hours memory, 375 vCPU-minutes, and 200 GB-hours disk per month before overage — plus separate Workers, Durable Objects, and egress charges.
Official documentation (verify before relying on limits, which change): https://developers.cloudflare.com/containers/ | https://developers.cloudflare.com/containers/get-started/ | https://developers.cloudflare.com/containers/platform-details/ | https://developers.cloudflare.com/containers/platform-details/limits/ | https://developers.cloudflare.com/containers/pricing/
Known gotchas
There is no autoscaling yet. For stateless workloads you must fan out manually with `getRandom(binding, n)`; assuming automatic scale-out will bottleneck on a single instance.
All container disk is ephemeral. An instance that sleeps and restarts gets a completely fresh disk. Disk snapshots are listed as coming soon and are not available — never treat local disk as durable storage.
There is no swap memory. Exceeding the instance memory limit restarts the container rather than degrading performance, so size instance_type for peak, not average, memory.
Cloudflare gives no per-instance uptime guarantee — host maintenance can terminate an instance at any time. Design every container as disposable.
A container Worker is billed on three axes at once: container compute/memory/disk/egress, plus Workers, plus Durable Objects. Cost models that only count container time will be materially low.
Total image storage is capped at 50 GB per account; use `wrangler containers delete` to reclaim it. Account-wide concurrency ceilings are 6 TiB memory, 1,500 vCPU, and 30 TB disk.
Containers cannot manipulate iptables, which breaks Docker-in-Docker images unless they run with `--iptables=false`.
Give your agent this knowledge — and 15,800+ more routes
One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?