Docker announced the first technical preview of its integration with WebAssembly (Docker+Wasm) and said the company has joined the Bytecode Alliance as a voting member.

The Bytecode Alliance, founded by Mozilla, Fastly, Intel and Red Hat, is an organization that promotes WebAssembly standardization and aims to improve the WebAssembly ecosystem beyond the browser by collaboratively implementing standards and proposing new ones. It is currently actively promoting WASI (WebAssembly System Interface) to enable WebAssembly to securely access system resources such as files, networks, and memory.

Bytecode Alliance

Docker+Wasm makes it easier for developers to quickly build applications for the Wasm runtime, the announcement reads. The diagram below shows how Docker integrates with WebAssembly.

shows how Docker integrates with WebAssembly

As you can see, Docker Engine continues to use the containerd container runtime in line with the overall ecosystem, but creates a new containerd shim - replacing runC, which is responsible for running container processes, with WasmEdge runtime. This is said to be a collaborative project with WasmEdge, and this containerd shim takes the Wasm module from the OCI artifact and uses the WasmEdge runtime to run it.

Docker didn’t give any more details, but WasmEdge promises to deliver better boot times than Linux containers, and WasmEdge applications are significantly smaller and faster.

Michael Irwin, co-founder of Docker, wrote, “We see Wasm as a complementary technology to Linux containers, and developers can choose the technology option that works best for their situation (or both). As the community explores Wasm, we hope developers can use familiar and favorite experiences and tools to help make Wasm applications easier to develop, build, and run.”

Usage

The sample Wasm application can be launched using the following command.

1
docker run -dp 8080:8080 --name=wasm-example --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm32 michaelirwin244/wasm-example

Parameter explanation.

  • -runtime=io.containerd.wasmedge.v1- Tells Docker Engine to use Wasm containerd shim instead of the standard Linux container runtime
  • -platform=wasi/wasm32- Specifies the architecture of the image to be used. By leveraging the Wasm architecture, developers do not need to build separate images for different architectures. wasm runtime will complete the final step of converting the Wasm binaries to machine instructions.

How to get it

Download the Technology Preview version of Docker Desktop to experience Docker+Wasm:.

It is important to note that since Docker+Wasm is still in the early technology preview phase, it is not recommended for use in production environments because of the possibility of changes or even removal from future releases.

For more information, see https://docs.docker.com/desktop/wasm/