CLOUDFLARE · CONTAINERS · LIVE DEMO

A real Python + headless Chromium container, running on Cloudflare's network, invoked by a Worker. Type a URL, get a screenshot back. This is the kind of workload Workers can't do alone.

Try it live

cloudflare.com developers.cloudflare.com radar.cloudflare.com news.ycombinator.com github.com
Total latency (ms)
Image size
1280×800
Viewport
Container instance
Click "Take screenshot" to invoke the container. Heads up: the first request after a cold start can take 10–30 seconds while the container spins up. Repeat requests are fast.

The Dockerfile

FROM mcr.microsoft.com/playwright/python:v1.47.0-jammy WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . EXPOSE 8080 CMD ["python", "app.py"]

The Worker that invoked it

// Route the request to a container instance. // One line to fan out to N containers. const id = env.SCREENSHOT_CONTAINER .idFromName("screenshot-" + hash(url)); const stub = env.SCREENSHOT_CONTAINER.get(id); const resp = await stub.fetch( "http://container/screenshot", { method: "POST", body: JSON.stringify({ url }) } ); return resp;

When to reach for a Container vs a Worker

→ Workers

  • Stateless request/response in milliseconds
  • API endpoints, redirects, edge logic
  • Data transforms, auth, personalization
  • JavaScript, TypeScript, Python, Rust (WASM)
  • 128 MB memory, 30 sec CPU on request

→ Containers

  • Full Linux VM, any language, any binary
  • Headless Chrome, ffmpeg, PDF generation
  • Existing Docker images you don't want to rewrite
  • Heavy dependencies (ML runtimes, Playwright)
  • Long-running processes, background work

Cost comparison · 100k screenshots / month

Line item AWS Fargate Cloudflare Containers
Compute (vCPU + memory) ~$85 / month ~$25 / month
Load balancer (ALB / NLB) $18 / month + LCU $0 (included)
NAT gateway (for outbound) $32 / month + data $0 (included)
Egress (100 GB) $9 / month $0 (no egress fees)
Provisioning & ops overhead VPC, IAM, task defs, security groups Dockerfile + wrangler deploy
Monthly total (rough) ~$144 + ops time ~$25

▶ Why this matters

Same platform, different tool. This container is deployed the same way a Worker is: one wrangler deploy command, same account, same dashboard, same bill. When the customer's team already knows Workers, Containers is a natural next step.

No infrastructure to run. There's no ECS cluster, no VPC, no NAT gateway, no ALB, no autoscaling group. The Container just runs when a request comes in and sleeps when idle. You define resource limits and instance counts, Cloudflare handles the rest.

Lift-and-shift friendly. The container is a plain Dockerfile with a Python Flask app. Any language, any binary. If your customer has an existing Docker image running on ECS or Kubernetes, it can move here without a rewrite.

Egress is $0. Data leaving the container to the internet, to R2, or back to the Worker doesn't cost bandwidth. Compare that to Fargate + NAT gateway + data transfer, which stacks charges at every layer.

When Workers can't do it. This demo runs headless Chromium via Playwright. That's a 300+ MB binary that needs a full Linux userspace. It can't run in a Worker. Containers fill exactly that gap on the same platform.