liveBook · Manning

Docker

As explained in Server-Side WebAssembly

Docker is a platform and command-line toolset for building, packaging, and running applications in containers.

Docker packages a Wasm host environment so a compiled guest module can run with a single command. Docker Engine provides a lightweight CLI, while Docker Desktop adds a graphical interface. section 2.3.5

Docker supports Wasm execution through familiar container tooling:

  • Mount a local directory into the container so the host application can read a .wasm file. section 2.3.5
  • Use --rm for temporary execution, automatically removing the container afterward. section 2.3.5
  • Understand the traditional engine path as Docker Engine, containerd, containerd-shim, and runC; Wasm execution substitutes a Wasm-specific shim and runtime. section 7.2
  • Treat Docker+Wasm support as experimental and potentially unstable across environments and Docker versions. section 7.2

Run a Wasm guest with Docker

From the guest project directory, copy the compiled module into the working directory, then mount that directory and run the published host image: `docker run --rm -v ".:/data" ghcr.io/danbugs/serverside-wasm-book-code/hello-world-host:latest /data/hello_world_guest.wasm 'Dan'`. The host reads the module and prints `Hello, Dan`. section 2.3.5

Figure 7.4 A closer look inside the Docker engine when executing a Wasm module, showing the key components, including containerd-shim-wasm and the Wasm runtime

Use the architecture figure to compare Docker's traditional container path with its Wasm execution path, including containerd-shim-wasm and the Wasm runtime. section 7.2

How Server-Side WebAssembly covers it

How deep it goes
Traces Docker Engine through runC, containerd-shim, and containerd, then contrasts the Wasm runtime path.
Examples
Demonstrates copying a compiled module, mounting it, invoking a published image, and producing Hello, Dan.
What it assumes
Assumes a compiled Wasm module and Docker installation, while introducing Engine-versus-Desktop options and version checking.
What you can do after
Operate/configure Docker to run a Wasm module through a mounted directory and temporary container.
How it connects
Connects Docker Engine with runC, containerd, containerd-shim, containerd-shim-wasm, and the Wasm runtime.

Also explained in

Compare how 26 books explain Docker →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Server-Side WebAssembly. The section links point to the parts of the book it draws on.