June 29, 2023·4 min read·engineeringdockerwasmcontainerd

Docker Desktop adds on-demand Wasm runtimes through containerd

Desktop 4.21 adds downloadable Slight, Spin and Wasmtime runtimes. The containerd shim explains how Docker can manage workloads with a different execution model.

Docker can reuse image distribution and lifecycle management without requiring every workload to execute as a conventional Linux application. Desktop 4.21, released June 29, adds on-demand downloads of Slight, Spin and Wasmtime when the containerd image store is enabled. The useful change is the integration of runtime choices into the development environment. The command and image package can remain familiar while the runtime responsible for execution changes.

This work has a history within the year. Docker's March technical-preview announcement introduced these runtime choices in a special preview build. Today's Desktop release brings their installation into the product's containerd-backed workflow. It would be inaccurate to describe the runtimes as a new invention of this release.

I am interested in this separation because Docker's packaging model is useful independently of the kernel mechanisms that first made its containers possible. A portable package and a repeatable construction process have value even when execution uses a different runtime. The runtime still determines what the application can do, so familiar tooling does not establish application compatibility.

The shim connects lifecycle operations

The runwasi version 0.1.0 documentation describes a library for integrating Wasm hosts with containerd. Its example implementation provides an Instance interface for creating and starting an instance. The interface also covers signaling and deletion, with a wait operation that returns an exit code and time.

These operations explain what the integration needs to translate. Container management requires a way to start work and observe its termination. The Wasm host supplies the execution implementation, while the shim connects it to the lifecycle expected by containerd. That relationship is more precise than saying that Wasm runs inside an ordinary container.

The documented Wasmtime shim uses a runtime identifier that selects its implementation. The binary must be discoverable by containerd. This shows why distributing the application image is only part of the arrangement. The machine executing it also needs the appropriate runtime integration. Desktop's on-demand installation addresses that local prerequisite for the supported choices.

The early runwasi documentation labels its implementation alpha quality. That source describes the integration design, not a production-readiness guarantee for every later package that uses it. Keeping the scope explicit helps distinguish the interface being explained from the support status of a particular distributed runtime.

A package can contain a Wasm entry point

Docker's March preview demonstrates a small content-management application packaged in an image built from scratch. Its Dockerfile copies application files into the image and selects a Wasm module as the entry point. The runtime selection then determines how that entry point is executed. A scratch base does not mean that the executing machine has no software responsibilities.

For a conventional static binary, a minimal image can omit build tools and other runtime files the program does not need. A Wasm package can likewise contain the application artifact while relying on a host runtime for execution. These are distinct contracts despite the similarity of a small image. One cannot infer the execution requirements from image size alone.

The image's contents and the runtime's capabilities have to agree. A program that requires a particular host facility cannot obtain it merely because its module is stored in an image. The Docker interface helps package and launch the workload, while the selected Wasm implementation supplies the host environment. This is the boundary that a useful example must make clear.

The content store handles distribution

The containerd content-flow documentation describes stored content as separate from the filesystem snapshots used for execution. It also describes image indexes that select manifests by platform. Those distinctions explain why an image store can support a broader range of packaged artifacts than one particular execution mechanism.

Desktop's release notes make the containerd store a prerequisite for downloading the new Wasm runtimes. This is a specific product dependency. It does not mean enabling the store automatically converts an existing application into Wasm. The workload still needs an appropriate artifact and a compatible runtime.

For developers, that separates two kinds of work. Packaging determines what content is available to the runtime. Runtime integration determines how the lifecycle request becomes execution. An application may use the same registry workflow as another service and still have different host requirements. Keeping the distinction visible avoids treating a successful pull as evidence that the workload can run.

I prefer this reuse of distribution tooling where the runtime contract remains explicit. A second packaging system would add another set of artifacts to manage. Using an existing image workflow can reduce that duplication, provided the selected runtime and its requirements are documented beside the package.

Build inspection is a separate addition

The same Desktop release introduces a beta Builds view for inspecting builds and managing builders. The release notes place it in the development-features settings. This is a different capability from Wasm execution, but both changes make choices beneath a familiar Docker command more visible to the developer.

A builder creates the artifact, while a runtime executes the selected entry point. Those roles can involve different components and configuration. An inspection view is useful when a command's result depends on which builder handled it. Runtime selection remains a separate part of describing how the resulting workload starts.

Desktop also adds Rust server support to the beta initializer in this release. That concerns generated project configuration. It should not be treated as evidence that a generated Rust project targets Wasm or uses one of the new runtimes. Language support in initialization and target selection during compilation answer different questions.

The June release therefore offers a concrete way to explore Wasm execution with existing Docker packaging. A compatible workload can use the downloaded runtime integration once the required content store is enabled. Its distribution format remains familiar, while the shim supplies the lifecycle connection between containerd and the host that executes the module.