---
title: "Cloudflare Containers - Global Container Platform"
description: "Run containers globally with one command. No Kubernetes, no regions. Any programming language, anywhere across Cloudflare's global network with automatic placement."
url: "https://www.cloudflare.com/products/containers"
---

# Containers

> Run containers globally with one command. No Kubernetes, no regions. Run code written in any programming language, everywhere it's needed across Cloudflare's global network.

## Key Features

- Docker container support
- Any language or framework
- Automatic scaling to zero
- Global deployment
- Workers integration
- GPU support (coming soon)
- Persistent storage options

## Benefits

### Programmable

Manage the full container lifecycle from code in your Worker. No YAML or configuration language to learn.

### Global

Cloudflare automatically places each instance in the optimal location across our global network.

### Simple

Deploy with one command, no devops experience required.

## Use Cases

### Run AI generated code securely

Execute untrusted code in a fully isolated environment per session or per user. Give your AI agents the ability to generate and run code.

### Run latency sensitive services close to end users

Deploy compute-intensive workloads that need to run near users for optimal performance. Cloudflare automatically places each instance in the optimal location across our network.

### Run compute intensive workflows and background jobs

Process data, images, videos or any content that demands multiple CPU cores, extra memory, or a specialized runtime.

### Provide sandboxed dev environments

Spin up complete development environments on-demand for testing, CI/CD, or collaborative coding.

## Code Examples

### Define Container

Define and customize your container with N lines of code. Bring your own images to use any language with more compute power on Workers.

```typescript
class CodeSandbox extends Container {
  defaultPort = 1337; // pass requests to this port by default, including WebSockets
  sleepAfter = "15m"; // automatically sleep containers after inactivity, save $$$
}
```

### Integrate With Workers

Handle incoming requests in your Worker, and forward them to a specific container instance, spun up on demand, close to the end user.

```typescript
async fetch(request, env) {
  const { sessionId } = await request.json();

  // Get a new container instance for each session, and pass requests to it
  const containerInstance = getContainer(env.CODE_SANDBOX, sessionId);

  return containerInstance.fetch(request);
}
```

### Manage the full container lifecycle from code

Handle errors, exit statuses, health checks, trigger cron jobs, scale up additional instances — all from code in your Worker.

```typescript
class BuilderContainer extends Container { 
  async onStop() {
    await this.env.QUEUE.send({ status: "success", message: "Build Complete" });
  }

  async onError(err) {
    await this.env.QUEUE.send({ status: "error", message: err });
  }

  async isRunning() { return this.ctx.container.running; }
}
```

## Resources

- [Full Documentation](https://developers.cloudflare.com/containers): Complete technical documentation
- [Get Started](https://dash.cloudflare.com/sign-up): Sign up and start building
- [Pricing](/plans.md): See pricing details

## Related Products

- [Browser Run](/products/browser-rendering.md): Automated browsers
- [Cloudflare Pages](/products/pages.md): Build & deploy frontend sites
- [Durable Objects](/products/durable-objects.md): Stateful compute
- [Email Service](/products/email-service.md): Send and receive email

---

*This is a markdown version of [https://www.cloudflare.com/products/containers](https://www.cloudflare.com/products/containers) for AI/LLM consumption.*
