7 Introduction to Wasm containers with Docker

 

This chapter covers

  • The differences between containers and Wasm
  • Wasm containers
  • Distributing Wasm as OCI images
  • Containerizing wasmCloud applications
  • Converting containers to Wasm

We’ve come a long way from manually handling String objects by storing their UTF-8 encoded characters in a Wasm module’s linear memory and passing them across the host-to-module boundary using integer parameters for the String's length and memory location. In the previous chapter, we explored wasmCloud—a high-level Wasm runtime—and saw how it enables the use of standard and non-standard WIT interfaces to bring higher-level capabilities such as key-value stores and machine learning models to our Wasm applications.

However, one important aspect we’ve yet to explore—aside from briefly mentioning it in chapter 1—is Wasm’s distribution story. Traditionally, developers distribute and deploy their applications using containers, which package code and its dependencies into a single unit, allowing applications to run consistently across environments, from local machines to cloud platforms. At first glance, Wasm, as a hardware abstraction layer, may sound similar to containers—and if you think so, you’re not wrong!

7.1 Containers vs. Wasm

7.2 Wasm containers

7.3 Running a Wasm container

7.4 Wasm and the Open Container Initiative

7.4.1 Packaging and publishing Wasm components as OCI images

7.4.2 Inspecting Wasm component OCI images

7.4.3 Pulling and running Wasm OCI images

7.5 wasmCloud and Wasm containers

7.6 Converting Linux containers to Wasm

7.6.1 Introducing container2wasm

7.6.2 Installing container2wasm

7.6.3 Using container2wasm

7.7 Summary