| 1 | # Sandbox |
| 2 | |
| 3 | The Cloudflare Sandbox SDK on celld: each sandbox is a Durable Object that |
| 4 | supervises a container built from the `cloudflare/sandbox` image, and the |
| 5 | `@cloudflare/sandbox` package drives it from the Worker. Commands, files, |
| 6 | and background processes run inside the container. |
| 7 | |
| 8 | Install the dependency, then run the example. The first request pulls the |
| 9 | base image, which is about 225 MB, so it takes a while: |
| 10 | |
| 11 | ```sh |
| 12 | npm install |
| 13 | celld dev |
| 14 | curl 'http://127.0.0.1:9876/exec?cmd=uname+-a' |
| 15 | curl 'http://127.0.0.1:9876/write' |
| 16 | curl 'http://127.0.0.1:9876/serve' |
| 17 | curl 'http://127.0.0.1:9876/processes' |
| 18 | curl 'http://127.0.0.1:9876/exec?id=other&cmd=ls+/workspace' |
| 19 | ``` |
| 20 | |
| 21 | Each `id` is one sandbox with its own filesystem, so the second `ls` shows |
| 22 | an empty workspace. Deploy to a fleet from this directory: |
| 23 | |
| 24 | ```sh |
| 25 | celld deploy . --bucket s3://my-cells-bucket |
| 26 | ``` |
| 27 | |
| 28 | `celld deploy` saves the image to the bucket once, and each node loads it |
| 29 | the first time one of its sandboxes starts. Preview URLs, tunnels, and |
| 30 | bucket mounts are features of the package and of the container; see the |
| 31 | [Cloudflare compatibility](../../docs/cloudflare-compat.md#containers) |
| 32 | notes for what celld does not provide. |