Cloudflare Sandbox vs Railway
Cloudflare Sandbox gives you containers, each in its own microVM, that you drive from a Worker and that sleep when idle and wake on the next request. Railway is an app platform for services and databases that added Linux VM sandboxes in 2026, which are destroyed after an idle timeout.
The companies and products
Cloudflare Sandbox
Cloudflare Sandbox SDK runs untrusted or AI-generated code in Linux containers on Cloudflare's network, driven from a Cloudflare Worker.
Each sandbox is a Cloudflare Container backed by a Durable Object, and each container runs in its own Firecracker microVM with its own kernel and network. You build a linux/amd64 image, pick an instance type of up to 4 vCPU and 12 GiB, and reach the sandbox through your own Worker. It suits teams already on Workers who want short-lived sandboxes that sleep when idle; for code that only calls known methods, Cloudflare also offers Dynamic Workers, which run JavaScript in V8 isolates.
- Largest instance
- 4 vCPU, 12 GiB memory, 20 GB disk (defaults, can be raised)
- Account limits
- 1,500 vCPU, 6 TiB memory and 30 TB disk running at once
- Compliance
- Cloudflare holds a SOC 2 Type II report
Railway
Railway is a cloud platform for deploying web apps, servers and databases, which now also sells sandboxes and cloud agents.
Railway's main product is app hosting: you deploy services and databases as containers on its own hardware. In 2026 it added Sandboxes, isolated Linux VMs you create from the CLI or a TypeScript SDK, run commands in and destroy, and Cloud Agents, a personal VM for running a coding agent, in early access. It suits teams already hosting on Railway who want throwaway machines next to their apps.
Which use cases each one fits
For each use case, Battleships prices every sandbox provider on the same workload and sorts them from the cheapest monthly bill up. “13th cheapest of 345” means 12 of the other 344 providers run that workload, with every feature it needs, for less. “With limits” means the provider runs it but misses something, so it is listed after every full match. Open a use case for its whole ranking and what each provider misses.
| Use case and its workload | Cloudflare Sandbox: price rank | Railway: price rank | bochka: price rank |
|---|---|---|---|
| Software factory 100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month A software factory needs machines that keep their work; Cloudflare wipes the disk on sleep and Railway destroys idle sandboxes, while bochka keeps the disk and adds Docker and a desktop. | 162nd of 367, with limits $1,543 a month | 51st of 367, with limits $342 a month | 3rd cheapest of 367 $634 a month |
| Always-on AI employees 50 machines 24/7 · 2 vCPU / 4 GB Railway fits always-on assistants if you set the idle timeout to 0, with memory billing the whole time; Cloudflare wipes the disk on sleep, and bochka keeps it across stops. | 207th of 366, with limits $2,188 a month | 16th cheapest of 366 $3,977 a month | 5th cheapest of 366 $657 a month |
| Code interpreter bursts 100 at once · 1 vCPU / 2 GB · 200,000 sessions of 1 min a month Both fit short code runs; Cloudflare bills CPU only while busy and wakes a sleeping sandbox on the next request, which makes it the stronger pick of the three here. | 13th cheapest of 345 $144 a month | 36th cheapest of 345 $413 a month | 186th of 345, with limits $2,000 a month |
| Sandboxes for your users 300 at once · 2 vCPU / 4 GB · 30,000 sessions of 23 min a month Cloudflare fits sandboxes for your users fully, while Railway's 100 sandboxes per environment on Pro means 300 at once needs several environments; bochka fits too and adds per-sandbox spend limits. | 9th cheapest of 361 $731 a month | 42nd of 361, with limits $290 a month | Cheapest of 361 $209 a month |
| RL rollouts 1,000 at once · 2 vCPU / 4 GB · 1,000,000 sessions of 3 min a month | 144th of 360, with limits $9,428 a month | 78th of 360, with limits $4,450 a month | 34th of 360, with limits $2,000 a month |
| Agent evals 250 at once · 4 vCPU / 8 GB · 15,000 sessions of 20 min a month Cloudflare fits agent evals, while Railway can fork a running sandbox but caps how many run per environment; bochka forks running sandboxes and runs up to 2,000 at once by plan. | 45th cheapest of 364 $818 a month | 108th of 364, with limits $364 a month | 10th cheapest of 364 $200 a month |
| CI runners 40 at once · 8 vCPU / 16 GB · 6,000 sessions of 12 min a month CI jobs that build images need Docker: Cloudflare runs docker:dind with iptables off and 20 GB of disk by default, Railway's sandbox docs do not mention Docker, and bochka has full Docker. | 301st of 377, with limits $704 a month | 113th cheapest of 377 $1,210 a month | 4th cheapest of 377 $86 a month |
| 24/7 dev boxes 1 machine 24/7 · 4 vCPU / 8 GB Both fit a 24/7 dev box at about the same cost, but Cloudflare starts from a fresh disk after sleep and Railway's Cloud Agents are early access; bochka stops at no cost and keeps its disk. | 70th cheapest of 368 $93 a month | 66th cheapest of 368 $89 a month | 18th cheapest of 368 $26 a month |
| Computer-use agents 50 at once · 4 vCPU / 8 GB · 20,000 sessions of 15 min a month Neither ships a desktop: Cloudflare removed its built-in one and Railway sandboxes are headless, while bochka has a 60fps desktop and a computer-use API. | 166th of 369, with limits $460 a month | 77th of 369, with limits $103 a month | 6th cheapest of 369 $200 a month |
| Browser-use agents 50 at once · 2 vCPU / 4 GB · 30,000 sessions of 10 min a month | 210th of 367, with limits $233 a month | 53rd of 367, with limits $93 a month | 7th cheapest of 367 $200 a month |
| Scraping & bots (startup scale) 50 at once · 1 vCPU / 2 GB · 100,000 sessions of 3 min a month | 250th of 346, with limits $286 a month | 60th cheapest of 346 $570 a month | 6th cheapest of 346 $90 a month |
| Mass scraping & bots (undetectable) 1,000 at once · 1 vCPU / 2 GB · 3,000,000 sessions of 2 min a month | 169th of 338, with limits $5,741 a month | 109th of 338, with limits $2,988 a month | 71st of 338, with limits $1,800 a month |
| Parallel red teaming 200 at once · 2 vCPU / 4 GB · 5,000 sessions of 30 min a month | 239th of 360, with limits $325 a month | 43rd of 360, with limits $574 a month | 2nd cheapest of 360 $200 a month |
| GPU eval jobs 10 at once · 8 vCPU / 32 GB · 500 sessions of 30 min a month | Can't run it | Can't run it | Can't run it |
| macOS agents 5 at once · 4 vCPU / 8 GB · 1,000 sessions of 20 min a month | Can't run it | Can't run it | Can't run it |
Key features
| Feature | Cloudflare Sandbox | Railway | bochka |
|---|---|---|---|
| Isolation | Firecracker microVM per container, own kernel and network | Sandboxes are isolated Linux VMs; app services are containers | Full VM with its own kernel on dedicated AMD Ryzen 9 9950X hosts |
| Largest machine | 4 vCPU / 12 GiB / 20 GB disk by default (can be raised) | 8 vCPU / 8 GB on Hobby, 32 vCPU / 32 GB on Pro | 8 vCPU / 16 GB on the $20 plan, 16 vCPU / 32 GB from $100 |
| When the sandbox goes idle | Sleeps after inactivity and wakes on the next request, with a fresh disk | Destroyed after the idle timeout (30 minutes by default); files survive only in checkpoints you take | You stop it; the disk is kept, with snapshots every minute and on stop, and a stopped sandbox costs nothing |
| Fork a running sandbox | No fork; restore a saved snapshot or backup into a new sandbox | Fork a running sandbox's filesystem; named disk checkpoints to boot new ones | Fork a running sandbox without stopping it; named snapshots to start new ones |
| Docker inside | docker:dind with iptables and IP forwarding turned off | Root shell on Ubuntu; the sandbox docs do not mention Docker | Full Docker, root and systemd |
| Nested virtualization | Not documented | Not mentioned in the sandbox docs | Yes, /dev/kvm (Android emulators, VMs) |
| Desktop and computer use | Built-in desktop removed in SDK 0.10.2; bring your own | Headless: terminal, exec and SSH only | 60fps desktop and Chromium, computer-use API, embeddable stream |
| Inbound traffic | HTTP and WebSocket previews routed through your Worker; no raw TCP or public IP | Up to 10 public HTTPS domains, set only at creation; SSH and port forwarding | HTTPS URLs for up to 50 ports, token-protected; raw TCP; own IPv6 or IPv4 |
| Egress control | allowedHosts deny-by-default list plus outbound handlers you write in Worker code | No egress allowlist for sandboxes | No provider-side allowlist |
| Keeping keys out of the sandbox | Your outbound handler adds the token for any HTTP or HTTPS host; you write the code | Secrets sit in the sandbox as environment variables, or are signed in and saved in a checkpoint | Managed proxy for model providers and any HTTPS API you register; switch a credential to another account |
| Coding agents | Run Claude Code, Codex, OpenCode or Pi in your own image; OpenCode has an SDK helper | Claude Code, Codex, OpenCode and Pi preinstalled; you run them headless through exec | Claude Code, Codex, OpenCode and more preinstalled, with a prompt, steer and events API |
| Sandboxes at once | Account limit of 1,500 vCPU running at once by default | 50 per environment on Hobby, 100 on Pro; Enterprise can ask for more | 100 to 2,000 by plan |
| Platform around the sandbox | Sits next to Workers, Durable Objects and R2 | Postgres, Redis and services in the same project; a sandbox can join their private network | Sandboxes only; host your own services inside a VM |
| Regions | Several regions across Cloudflare's network, nearest free instance picked | US West, US East, Amsterdam and Singapore; new sandboxes start in US West | EU only: Germany, Finland, France |
Every feature Battleships tracks (43)
| Feature | Cloudflare Sandbox | Railway | bochka |
|---|---|---|---|
| Full VM (own kernel) | Yes | Yes | Yes |
| Docker inside | Yes | Not published | Yes |
| Nested virtualization | No | No | Yes |
| Root | Yes | Yes | Yes |
| Systemd | Not published | Not published | Yes |
| Desktop GUI | No | No | Yes |
| Browser | No | Yes | Yes |
| Computer-use API | No | No | Yes |
| SSH | Yes | Yes | Yes |
| Persistent disk | No | Yes | Yes |
| Pause/resume | No | Yes | Yes |
| Automatic snapshots | No | No | Yes |
| Fork/clone | No | Yes | Yes |
| Live fork (no pause) | No | Yes | Yes |
| Memory fork | No | No | No |
| Custom image (Docker or snapshot) | Yes | Yes | Yes |
| ≥24 h sessions | Yes | Yes | Yes |
| Idle auto-stop | Yes | Yes | No |
| Wake on request | Yes | No | No |
| HTTPS preview URLs | Yes | Yes | Yes |
| Raw TCP inbound | No | No | Yes |
| Public IPv4 | No | No | No |
| Egress allowlist | Yes | No | No |
| Secret proxy | Yes | No | Yes |
| Secret proxy for any API | Yes | No | Yes |
| Preinstalled agents | Yes | Yes | Yes |
| Agent harness API | Yes | Yes | Yes |
| MCP server | No | Yes | No |
| GPU | No | No | No |
| Windows | No | No | No |
| Arm64 | No | No | No |
| Self-hosting | No | No | No |
| BYOC | No | Yes | No |
| Open source | Yes | No | No |
| Scoped API keys | Not published | Not published | Yes |
| Spend limits | No | Yes | Yes |
| Usage per sandbox (API) | Not published | No | Yes |
| Audit logs | Yes | Yes | No |
| SSO | Yes | Yes | No |
| SOC 2 | Yes | Yes | No |
| HIPAA | Yes | Yes | No |
| EU data residency | Yes | Yes | Yes |
| Zero data retention | Not published | Not published | Yes |
Performance
There is no comparable CPU measurement for Cloudflare Sandbox or Railway: neither has a result on StarSling's hpc-sandbox-benchmarks Node.js build-and-test loop. bochka did 26.69 runs per second there at 4 vCPU / 8 GB, so we cannot say which of the three is fastest.
Node.js build-and-test loop at 4 vCPU / 8 GB, higher is better. Measured with the open hpc-sandbox-benchmarks suite. Cloudflare Sandbox and Railway have no published run in this suite yet, so there is no like-for-like number to compare.
Pricing in five scenarios
Each bill is priced from the providers' public price lists by the open Battleships engine, with the cheapest plan that runs the scenario.
| Scenario | Cloudflare Sandbox, a month | Railway, a month | bochka, a month |
|---|---|---|---|
| One coding agent, workdays 4 vCPU / 8 GB, 50 GB disk, 8 hours a day, 22 days a month, files kept between days | $39 · Workers Paid · with limits | $16 · Hobby · with limits | $20 · $20/mo |
| One agent that never stops 4 vCPU / 8 GB, 50 GB disk, running 24/7 all month | $148 · Workers Paid · with limits | $70 · Hobby · with limits | $26 · $20/mo |
| 50 agents in parallel 50 machines of 4 vCPU / 8 GB at once, 8-hour sessions, 1,100 sessions a month, Docker inside | $1,660 · Workers Paid · with limits | $739 · Hobby · with limits | $317 · $20/mo × 3 seats |
| Sandboxes for your users 2 vCPU / 4 GB, 30,000 sessions of 10 minutes a month, up to 300 at once | $476 · Workers Paid | $223 · Pro · with limits | $200 · $100/mo × 2 seats |
| 1,000 short jobs at once 2 vCPU / 4 GB, 1,000 at once, 3 minutes each, 200,000 jobs a month | $1,889 · Workers Paid · with limits | $781 · Pro · with limits | $2,000 · $2000/mo · with limits |
Cloudflare Sandbox: You need Workers Paid ($5 a month minimum). CPU is billed only while busy; memory and disk are billed on the instance size you picked until the container sleeps, and 4 vCPU always comes with 12 GiB.
Railway: Railway bills sandboxes per second at $50 per vCPU-month on CPU used and $50 per GB-month on memory in use, which keeps billing while a sandbox waits. It does not publish a price for sandbox disk or checkpoints, so its bills here leave disk out.
Railway: You pick a monthly plan from $20, and all of it becomes usage credit spent per second on running sandboxes. A stopped sandbox costs nothing and keeps its disk.
Limits in those scenarios
Cloudflare's disk resets after sleep, so no scenario that keeps 50 GB of files between days fits there, and its default 1,500 vCPU account limit is short of the 2,000 vCPU the 1,000-job burst needs. Railway is marked as an app platform with no published disk price, and its 100 sandboxes per environment on Pro do not cover 300 sandboxes for your users or 1,000 jobs at once. On bochka, the burst waits in a queue above 90 starts a minute and needs more starts a day than the $2,000 plan allows.
| Scenario | Cloudflare Sandbox | Railway | bochka |
|---|---|---|---|
| One coding agent, workdays |
|
| None that bite |
| One agent that never stops |
|
| None that bite |
| 50 agents in parallel |
|
| None that bite |
| Sandboxes for your users | None that bite |
| None that bite |
| 1,000 short jobs at once |
|
|
|
Which one should you use?
Use Cloudflare Sandbox when
your app already runs on Workers and you want short sandboxes that sleep when idle, wake on the next request, and follow egress rules you write.
- Sleeps when idle, wakes on request. Useful for many short, spiky sessions: a sandbox sleeps when idle, wakes on the next request, and bills CPU only while busy.
- Egress rules you can program. Useful when sandboxes run untrusted code: block every host except the ones you list, and run your own code on each outbound request.
- Built into the Workers platform. If your app already runs on Workers, sandboxes sit next to Durable Objects and R2, in several regions of Cloudflare's network.
Use Railway when
your app and databases already live on Railway and you want short-lived sandboxes on the same private network, with large machines and US or Asia regions.
- Your apps and databases in one place. Useful if your app already runs on Railway: sandboxes can join the same private network as your Postgres and services.
- Bigger sandboxes and forks. Useful for heavy jobs: Pro sandboxes go up to 32 vCPU / 32 GB, and you can fork a running sandbox's filesystem.
- Coding agents in the default image. Useful for a quick start: Claude Code, Codex, OpenCode and Pi come preinstalled, ready to run headless through exec.
Where bochka fits
Both Cloudflare and Railway are built around short-lived sandboxes next to a larger platform: one sleeps and loses its disk, the other is destroyed when idle. If what you are running is coding agents that work for hours or days, bochka gives each one a full VM that keeps its disk, with Docker, a desktop and an API to drive the agent from outside.
A disk that stays
On Cloudflare a sleeping sandbox wakes with a fresh disk, and on Railway an idle sandbox is destroyed after 30 minutes. Either way you write snapshot or checkpoint code, or on Railway turn the timeout off and pay for memory all along.
Docker, KVM and a desktop in one machine
Cloudflare runs Docker with iptables off on 20 GB of disk by default, and Railway's sandbox docs do not mention Docker. Neither has /dev/kvm or a desktop, so an agent cannot boot an emulator or check a UI in a real browser.
Agents driven from outside, keys kept outside
On Cloudflare you bake each agent into your image and write the outbound handler that adds every token. On Railway you shell agents through exec and their API keys sit inside the VM, where code the agent runs can read them.
Use bochka when your agents work for hours or days: a full VM that keeps its disk, with Docker, /dev/kvm, a desktop, and coding agents you drive from outside while their keys stay outside. Compare it one to one: bochka vs Cloudflare Sandbox and bochka vs Railway.
Questions people ask
Is Cloudflare Sandbox cheaper than Railway?
In our five scenarios Railway's estimate is lower every time, for example $70 against $148 for one agent running all month, but Railway's numbers leave out disk, which it does not price. Only Cloudflare fits the sandboxes-for-your-users scenario cleanly ($476 a month), because Railway Pro caps an environment at 100 sandboxes.
Which is faster, Cloudflare Sandbox or Railway?
We cannot say. Neither has a result on StarSling's public Node.js build-and-test benchmark, where bochka did 26.69 runs per second at 4 vCPU / 8 GB.
Can Cloudflare Sandbox or Railway run Docker?
Cloudflare supports docker:dind with the daemon's iptables and IP forwarding turned off, because containers cannot change iptables. Railway's sandbox docs do not mention Docker. bochka runs full Docker with root and systemd.
Do they keep my files?
Cloudflare keeps files only while the container runs; after sleep it starts from a fresh disk unless your code saved a snapshot or an R2 backup. Railway destroys a sandbox after its idle timeout, so files survive only in checkpoints you took. A bochka sandbox stops instead and keeps its disk.
Are they VMs or containers?
Both run VMs underneath. Cloudflare runs each container you ship in its own Firecracker microVM, and Railway's docs call each sandbox an isolated Linux VM, while its regular app services are containers. bochka sandboxes are full VMs too.
Where does each one run?
Cloudflare places sandboxes in several regions of its network and picks the nearest free instance. Railway runs in California, Virginia, Amsterdam and Singapore, and new sandboxes start in US West. bochka runs only in the EU, in Germany, Finland and France.
Try bochka
Install the CLI, then run bochka new.
Product preview
More comparisons
- bochka vs Cloudflare Sandbox
- bochka vs Railway
- E2B vs Cloudflare Sandbox
- Daytona vs Cloudflare Sandbox
- Modal vs Cloudflare Sandbox
- Vercel Sandbox vs Cloudflare Sandbox
- Cloudflare Sandbox vs Blaxel
- Cloudflare Sandbox vs Runloop
- Cloudflare Sandbox vs Tensorlake
- Cloudflare Sandbox vs Morph Cloud
- Cloudflare Sandbox vs CodeSandbox SDK
- Cloudflare Sandbox vs Northflank