Skip to content

Cloudflare Containers

Active
cloudflare/containers

The official @cloudflare/containers class for running containers from Cloudflare Workers: request proxying, WebSockets, outbound interception, lifecycle hooks and load balancing.

View on GitHub
Stars
279
Forks
45
Watchers
279
Open issues
65

Overview

@cloudflare/containers is the official class for interacting with Containers on Cloudflare Workers. It extends a container-enabled Durable Object with container-specific functionality.

Features

  • HTTP request proxying and WebSocket forwarding
  • Outbound request interception by host or with a catch-all handler, including HTTPS
  • Host allow/deny lists with glob patterns
  • Simple lifecycle management — start and stop containers
  • Event hooks: onStart, onStop and onError
  • A configurable sleep timeout that renews on each request
  • Load-balancing helpers such as getRandom

Installation

npm install @cloudflare/containers

Extend the Container class, set a defaultPort, and route requests to an instance with getContainer.

Similar open-source projects, ranked by shared categories and tags.

All DevOps projects →