BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Docker Launched WebAssembly Support

Docker Launched WebAssembly Support

Bookmarks

In the Cloud native Wasm day event at KubeCon NA 2022, Docker announced Docker+Wasm technical preview in partnership with CNCF’s Wasm runtime WasmEdge. With a single command, docker compose up, Docker developers can instantly build, share, and run a complete Wasm application.

Wasm was originally developed as a secure sandbox for the web browser. In recent years, it has found many applications on the server-side, as a secure, lightweight, fast, and portable alternative to VMs and Linux containers (LXCs) — an area that was originally pioneered by Docker.

The standard demo app in Docker+Wasm, provided by Second State, is a database-driven web application with one WasmEdge "container" for the entire web service (microservice), and two Linux containers for supporting services — one for the MySQL database and one for NGINX to server the static HTML page for the frontend UI. The three containers run side by side in the same network and form a single application. The microservice is written in Rust and compiled into Wasm. It has a high-performance (non-blocking) HTTP server, an event handler (for the business logic on how to process HTTP requests), and a MySQL database client. The entire "containerized" microservice is only 3MB, compared to hundreds of MBs for the Linux containers for the database and NGINX.

Source: Introducing the Docker+Wasm Technical Preview

Docker Compose not only runs those Wasm applications alongside containers but also builds the Rust source code into Wasm. Developers do not even need to install the Rust compiler toolchain since the entire build environment is also containerized by Docker. Docker + Wasm is a single tool that takes care of both building and running the Wasm applications.

As Docker started the container revolution that led to the cloud-native era, Docker’s commitment to supporting Wasm in a "multi-runtime" world is especially relevant.

The Docker+wasm announcement makes perfect sense. We no longer live in a single-runtime world: there are Linux containers, windows containers, and wasm containers. OCI can package them all, I should be able to build and run them all with @docker. — Solomon Hykes, co-founder of Docker.

The technologies behind Docker+Wasm were largely from the open-source community. For example, Docker relies on a containerd shim called runwasi, originally created by Microsoft’s DeisLabs, to start WasmEdge and execute the Wasm program.

The open-source work could go well beyond Docker. For example, the Red Hat team has integrated Wasm runtime support into OCI runtime crun. That enables the entire Kubernetes stack to support WasmEdge seamlessly apps. In fact, the Liquid Reply team has demonstrated Podman+Wasm using WasmEdge in the days leading up to the KubeCon event.

Other Wasm applications demonstrated at the KubeCon event include AI inference applications, Dapr-based microservices, and data processing functions in streaming pipelines. Now with Docker+Wasm, developers can easily build, share, and run these applications.

About the Author

Rate this Article

Adoption
Style

BT