Skip to content
Cloudflare Docs

Image Management

Pushing images during wrangler deploy

When running wrangler deploy, if you set the image attribute in you Wranlger configuration file to a path, wrangler will build your container image locally using Docker, then push it to a registry run by Cloudflare. This registry is integrated with your Cloudflare account and is backed by R2. All authentication is handled automatically by Cloudflare both when pushing and pulling images.

Just provide the path to your Dockerfile:

{
"containers": {
"image": "./Dockerfile"
// ...rest of config...
}
}

And deploy your Worker with wrangler deploy. No other image management is necessary.

On subsequent deploys, Wrangler will only push image layers that have changed, which saves space and time on wrangler deploy calls after the initial deploy.

Using pre-built container images

If you wish to use a pre-built image, first, push it to the Cloudflare Registry:

Wrangler provides a command to push images to the Cloudflare Registry:

Terminal window
npx wrangler push <image>:<tag>

Additionally, you can use the -p flag with wrangler containers build to build and push an image in one step:

Terminal window
npx wrangler containers build -p -t <tag> .

Then you can specify the URL in the image attribute:

{
"containers": {
"image": "registry.cloudflare.com/your-namespace/your-image:tag"
// ...rest of config...
}
}

Currently, all images must use registry.cloudflare.com, which is the default registry for Wrangler.

To use an existing image from another repo, you can pull it, tag it, then push it to the Cloudflare Registry:

Terminal window
docker pull <public-image>
docker tag <public-image> <image>:<tag>
wrangler containers push <image>:<tag>

Pushing images with CI

To use an image built in a continuous integration environment, install wrangler then build and pushi images using either wrangler containers build with the --push flag, or using the wrangler containers push command.

Registry Limits

Images are limited to 2 GB in size and you are limited to 50 total GB in your account's registry.

Delete images with wrangler containers delete to free up space, but note that reverting a Worker to a previous version that uses a deleted image will then error.