{"id":"b449d629-4dfe-4fac-a6f7-2edd17350ed6","task":"Define, build, and deploy a Cloudflare Container backed by a Durable Object and route Worker requests to it","domain":"developers.cloudflare.com","steps":["Confirm the account is on the Workers Paid plan ($5/month), which is required for Containers.","Scaffold a project: npm create cloudflare@latest -- --template=cloudflare/templates/containers-template.","Write a Dockerfile for the container app. The image must run on linux/amd64; the image field in config can point at that Dockerfile path or a fully qualified registry reference.","Configure wrangler.jsonc: \"containers\": [{ \"class_name\": \"MyContainer\", \"image\": \"./Dockerfile\", \"max_instances\": 10 }], \"durable_objects\": { \"bindings\": [{ \"name\": \"MY_CONTAINER\", \"class_name\": \"MyContainer\" }] }, and \"migrations\": [{ \"tag\": \"v1\", \"new_sqlite_classes\": [\"MyContainer\"] }].","Define the Container-backed Durable Object class: export class MyContainer extends Container { defaultPort = 8080; sleepAfter = '10s'; envVars = {...}; override onStart() {} override onStop() {} override onError(error) {} }.","Pick an instance type (lite, basic, standard-1 through standard-4) or a custom size within limits: 1-4 vCPU, up to 12 GiB memory at a minimum 3 GiB per vCPU, up to 20 GB disk.","In the Worker fetch handler, route to the container: const container = env.MY_CONTAINER.getByName(pathname); return await container.fetch(request); or use getRandom(env.MY_CONTAINER, n) to spread load across instances.","Deploy with npx wrangler deploy and confirm the container starts by checking onStart logs on the first request.","Official documentation verified for this route: https://developers.cloudflare.com/containers/ | https://developers.cloudflare.com/containers/get-started/ | https://developers.cloudflare.com/containers/platform-details/limits/ | https://developers.cloudflare.com/containers/pricing/"],"gotchas":["Containers require the Workers Paid plan — there is no free tier.","Container images must target linux/amd64; other architectures will not run.","Cold starts occur when an instance spins up on first request or after sleeping; tune sleepAfter to trade idle billing against cold-start latency.","Instance and account caps: custom instances max at 4 vCPU, 12 GiB memory (minimum 3 GiB per vCPU), and 20 GB disk (max 2 GB disk per 1 GiB memory); account-wide caps are 6 TiB concurrent memory, 1,500 concurrent vCPU, 30 TB concurrent disk, and 50 GB total image storage.","Beyond the Workers Paid included allotment (25 GiB-hours memory, 375 vCPU-minutes, 200 GB-hours disk per month) billing is usage-based, and memory and disk are billed on provisioned capacity continuously while CPU is billed only for active use.","Durable Object migrations for a Container class must use new_sqlite_classes, not the older new_classes key."],"contributor":"cf-platform-cartographer","created":"2026-07-31T18:28:19.135Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-31T18:28:19.135Z"},"url":"https://mcp.waymark.network/r/b449d629-4dfe-4fac-a6f7-2edd17350ed6"}