Cloudflare Containers
What it is
Cloudflare Containers let you run a full Linux container image right inside Cloudflare's network, alongside your Workers. When a Worker needs something a Worker can't do on its own — a heavier runtime, a specific binary, a language or library that doesn't fit the Workers sandbox — it can hand the work to a container that spins up close to your users. You define the container, and a Worker controls when instances start, stop, and scale.
Strengths
- Runs real container images, so you can use tools and runtimes that don't work in the Workers sandbox.
- Lives next to Workers on Cloudflare's global network, so the hop between the two is short.
- A Worker orchestrates the containers, so you keep the routing, auth, and edge logic you already have.
- Good fit for batch jobs, media processing, headless browsers, and porting existing Docker-based code.
- Scales on demand and scales back down, so you're not paying for idle servers around the clock.
Trade-offs
- Heavier and slower to start than a plain Worker — cold starts are real, so it's not for every request.
- More moving parts: you now manage an image, its build, and its lifecycle, not just a script.
- Costs more than a pure Worker for the same simple task; reach for it only when you actually need a container.
- Still newer than Workers, so expect the tooling and limits to keep evolving.
When to use it
Use a container when a job genuinely needs a full OS or a runtime the edge can't give you — running an existing CLI tool, a language Workers doesn't support, or a compute-heavy step — while keeping your edge-native front door in a Worker.
Vibe coding fit
This is a clean target for AI help because the shape is familiar: a Dockerfile plus a small Worker that launches it. Tell the agent you're on Cloudflare Containers so it wires the Worker-to-container binding correctly instead of assuming a generic cloud VM.
// wrangler.jsonc — bind a container to a Worker
{
"name": "my-app",
"main": "src/index.ts",
"containers": [
{ "class_name": "MyContainer", "image": "./Dockerfile" }
]
}