Sandbox runs on Containers. For deploy commands, Workers Builds, and rollout flags, refer to Deploy Containers and Rollouts.
To put exposePort() on a custom domain, refer to Configure preview URLs on a custom domain.
The Worker depends on @cloudflare/sandbox (or @cloudflare/sandbox@next). The container image must come from the same release line (Dockerfile and base image tags from the template or docs for that version).
When you bump the npm package:
-
Update the Dockerfile or image reference for the same line.
-
Run
wrangler deployso the new image is published. -
If the Worker and image must cut over together, deploy with an immediate rollout:
npx wrangler deploy --containers-rollout=immediateyarn wrangler deploy --containers-rollout=immediatepnpm wrangler deploy --containers-rollout=immediateUse this for stable to
@nextcutovers and other breaking package/image pairs. Refer to Migrate and Rollouts.
Do not mix a stable package with a @next image, or the reverse.
-
Start Docker if
imageis a Dockerfile path. Registry image references do not need Docker at deploy time. -
From the project root:
npx wrangler deployyarn wrangler deploypnpm wrangler deploy -
Confirm the Worker URL responds, then exercise a sandbox route.
The first deploy can take several minutes while the image provisions.
For production, use wrangler deploy so the package and image can update together.
Non-production Workers Builds defaults to wrangler versions upload, which does not publish a new image. Preview URLs are not generated for these Workers (they implement Durable Objects). Test with wrangler dev, or with a staging Worker or environment that runs wrangler deploy.
More detail: Before production.