Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Docker+Wasm Reaches Technical Preview 2, Includes Three New Runtime Engines

Docker+Wasm Reaches Technical Preview 2, Includes Three New Runtime Engines

This item in japanese

Docker has announced the second technical preview of Docker+Wasm, aiming to make it easier to run Wasm workloads and extending runtime support by including Fermyon's spin, Deislabs' slight, and Bytecode Alliance's wasmtime runtime engines.

The three new Wasm engines in Docker+Wasm bring the total number of supported runtimes to four, including WasmEdge, which was already supported in Docker+Wasm technical preview 1. All of them are based on the runwasi library, which recently joined the containerd project.

runwasi is a Rust library that enables running wasm workloads managed through containerd, thus effectively creating the abstraction of a new container type in addition to the Linux container originally supported by containerd. Runwasi, as its name implies, is based on WASI, a modular system interface for WebAssembly providing a common platform for Wasm runtimes. This means that if a program is compiled to target WASI, it can be run on any WASI-compliant runtime.

A Wasm container typically only includes a compiled Wasm bytecode file, without requiring any additional binary libraries, which makes it much smaller. This also implies a Wasm container is usually much faster to startup and more portable than Linux containers. For example, as WasmEdge co-founder Michael Yuan noted on Twitter, while a "slim" Python container image for Linux is over 40MB, its Wasm container counterpart takes less than 7MB.

As Wasm containers are directly supported by containerd, in order to try out Docker+Wasm technical preview 2 in Docker Desktop's latest release, the only required thing is enabling the "Use containerd" option under Settings > Features in development.

To run a Wasm container using wasmtime, you can then execute:

$ docker run --rm --runtime=io.containerd.wasmtime.v1 
--platform=wasi/wasm secondstate/rust-example-hello:latest

Thanks to this, Wasm containers can be run side by side with Linux containers using Docker Compose or other orchestration platforms such as Kubernetes. Additionally, Docker Desktop is able to package a Wasm app into an OCI container by embedding a Wasm runtime in it to enable sharing through a container registry, such as DockerHub and others.

About the Author

Rate this Article