Skip to content

Wrangler configuration

Last updated View as MarkdownAgent setup

Define Containers in the Wrangler configuration file for your Worker. Each Container is associated with a Durable Object class, which provides access to the Container at runtime.

Minimal configuration

A new Container application requires a Container definition, a Durable Object binding, and a Durable Object class export:

{
	"$schema": "./node_modules/wrangler/config-schema.json",
	"name": "my-container-worker",
	"main": "src/index.ts",
	// Set this to today's date
	"compatibility_date": "2026-10-05",
	"containers": [
		{
			"class_name": "MyContainer",
			"image": "./Dockerfile",
			"max_instances": 10,
		},
	],
	"durable_objects": {
		"bindings": [
			{
				"name": "MY_CONTAINER",
				"class_name": "MyContainer",
			},
		],
	},
	"exports": {
		"MyContainer": {
			"type": "durable-object",
			"storage": "sqlite",
		},
	},
}
"$schema" = "./node_modules/wrangler/config-schema.json"
name = "my-container-worker"
main = "src/index.ts"
# Set this to today's date
compatibility_date = "2026-10-05"

[[containers]]
class_name = "MyContainer"
image = "./Dockerfile"
max_instances = 10

[[durable_objects.bindings]]
name = "MY_CONTAINER"
class_name = "MyContainer"

[exports.MyContainer]
type = "durable-object"
storage = "sqlite"

The configuration uses three sections:

  1. containers defines the container image and associates it with a Durable Object class through class_name.
  2. durable_objects.bindings makes the Durable Object namespace available to Worker code. In this example, access it through env.MY_CONTAINER.
  3. exports declares the Durable Object class and provisions it with SQLite storage.

The class_name in containers and durable_objects.bindings, and the key in exports, must match the exported Durable Object class in your Worker.

Container settings

The containers entry can also configure the instance type, maximum number of running instances, image build, placement constraints, rollouts, and SSH access.

For all available fields and values, refer to the Containers Wrangler configuration reference.

Next steps

Was this helpful?