Cloudflare Containers Beta: Docker Edge Workers Auto-scale Pay-per-running
返回文章列表

Cloudflare Containers Beta: Docker Edge Workers Auto-scale Pay-per-running

Cloudflare Containers Public Beta 2025 Docker edge deployment Workers Durable Objects FFmpeg AI inference code sandbox global 320 cities pricing examples

Server Category 更新: January 8, 2026

Cloudflare Containers Public Beta 2025: รัน Docker Edge 320+ Cities Auto-scale

Cloudflare Containers รันคอนเทนเนอร์ทั่วโลกผ่าน Workers + Durable Objects Latency ต่ำสุด Sandbox per user Media processing AI inference Pay-per-running-time

Cloudflare Containers vs Competition

PlatformGlobal EdgeWorkers IntegrationCold StartPricing
Cloudflare320 citiesNative200msRunning only
Fly.io35 regions500msAlways-on
Render8 regions1sIdle charges
RailwayMulti-cloud800msFixed scale

Core Architecture

Request → Workers → Durable Objects → Containers

Auto-scale + Health checks

คุณสมบัติหลัก

🌍 Global deployment (320+ cities)
⚙️ Workers orchestration
💤 Sleep after idle (pay-per-use)
🔒 Per-container sandboxing
🌐 HTTP/WebSocket support
📈 Auto-scaling (CPU/memory)

Quick Deploy Example

// wrangler.toml
[[containers]]
name = "ffmpeg-converter"
image = "myregistry/ffmpeg:latest”
port = 8080
sleep_after = "1m”
min_instances = 1

// worker.js
export default {
async fetch(request, env) {
const container = env.FFMPEG.get(env.FFMPEG.idFromName("user123"));
return container.fetch(request);
}
}

npx wrangler deploy

Real-world Use Cases

1. Code Sandbox (Per User)

User1 → Container1 (Node.js)
User2 → Container2 (Python)
User3 → Container3 (Go)

2. FFmpeg Media Processing

Upload MP4 → Edge container → GIF output
Latency: 150ms (vs 2s centralized)

3. AI Model Inference

User request → Boot Llama.cpp → Inference → Sleep
Cost: $0.0001 per request

Pricing Model (Pay-per-running)

Running: $0.000015/GB-second
Sleep: $0 (free)
Boot time: 200ms (billed)
Min 1 instance: Configurable

ตัวอย่าง: 1000 req/day × 30s = $0.45/เดือน

Production Config

# wrangler.toml
[[containers]]
name = "app"
image = "docker.io/myapp:latest"
port = 3000
min_instances = 2
max_instances = 50
sleep_after = "5m"
cpu_threshold = 0.75
memory_threshold = 0.8

Advanced Patterns

Service Mesh via Workers

// Load balance 10 containers
const containers = Array(10).fill().map((_, i) =>
env.APP.get(env.APP.idFromName(`inst-${i}`))
);
const container = containers[Math.floor(Math.random() * 10)];
return container.fetch(request);

Health Checking

export class ContainerProxy {
async fetch(request) {
try {
const res = await this.container.fetch('/health');
if (!res.ok) throw new Error('Unhealthy');
return this.container.fetch(request);
} catch {
// Spin up new container
await this.restart();
}
}
}

Limitations

❌ No TCP/UDP (HTTP/WebSocket only)
❌ Cloudflare network only
⚠️ Cold start 200ms (acceptable)
✅ Perfect for stateless workloads

Migration from Other Platforms

Docker → Cloudflare: 5 mins setup
K8s → Containers: No YAML hell
Lambda → Containers: Full runtime
Vercel → Edge Containers: Global
D

DRITESTUDIO

DRITESTUDIO COMPANY LIMITED - Cloud, VPS, Hosting and Colocation provider in Thailand

管理您的 Cookie 设置

我们使用不同类型的 Cookie 来优化您在网站上的体验。点击下方类别了解更多信息并自定义您的偏好设置。请注意,阻止某些类型的 Cookie 可能会影响您的体验。

必要 Cookie

这些 Cookie 对于网站正常运行至关重要。它们支持页面导航和访问安全区域等基本功能。

查看使用的 Cookie
  • 会话 Cookie(会话管理)
  • 安全 Cookie(CSRF 保护)
始终开启

功能性 Cookie

这些 Cookie 启用语言偏好和主题设置等个性化功能。没有这些 Cookie,某些功能可能无法正常工作。

查看使用的 Cookie
  • lang(语言偏好)
  • theme(深色/浅色模式)

分析性 Cookie

这些 Cookie 通过匿名收集和报告信息,帮助我们了解访问者如何与网站互动。

查看使用的 Cookie
  • _ga(Google Analytics)
  • _gid(Google Analytics)

营销 Cookie

这些 Cookie 用于跨网站追踪访问者,以便根据您的兴趣展示相关广告。

查看使用的 Cookie
  • 广告 Cookie
  • 再营销像素

隐私政策