Wasm vs. Docker: A Different Kind of Isolation
Docker revolutionised how software is packaged and deployed. WebAssembly rethinks what isolation means at a more fundamental level, and that makes it a different model rather than an upgrade.
Docker Changed Everything
Before Docker, deploying software meant managing dependencies by hand, reasoning about what was installed on the target machine, and hoping the environment matched what you had tested against. Docker solved this elegantly: package everything the application needs into an image, run it in a container, and get consistent behaviour everywhere.
That model has served the industry well for over a decade. Containers are now the default unit of deployment for most cloud-native software.
But Docker was designed around a specific problem, environment reproducibility, and its isolation model reflects that. WebAssembly was designed around a different problem entirely, and the difference matters more as security and portability requirements get stricter.
What Docker Actually Isolates
A Docker container isolates a process using Linux kernel primitives: namespaces for visibility (the container can’t see other containers’ processes or files) and cgroups for resource limits (CPU, memory). The process inside the container runs native machine code on the real CPU, through the real kernel.
This is efficient and mature. It is also the source of Docker’s fundamental security limitation.
Because the container shares the host kernel, a kernel vulnerability or a container escape gives an attacker access to the host. The isolation is real but shallow: the operating system enforces the boundary, not the execution model itself. Containers can be locked down further, but the default is permissive. Network access, filesystem access, and system calls are all available unless explicitly restricted.
The security model is opt-out. You have to know what to remove.
What WebAssembly Isolates
A WebAssembly module doesn’t run native code. It runs inside a virtual machine that executes a well-defined instruction set, one that has no concept of files, networks, processes, or system calls by default. The host (the Wasm runtime) decides which capabilities to expose to the module, explicitly, at startup.
This is the capability model: nothing is accessible unless it has been granted. A module that needs to write to a specific directory gets a handle to that directory, not access to the filesystem. A module that needs to make outbound HTTP requests gets permission for exactly that, not general network access. A vulnerability in the module can’t reach anything it wasn’t explicitly given.
The security model is opt-in. You have to know what to add.
The distinction sounds subtle, but the practical consequence is big. In a Docker environment, a compromised container is a foothold into the host. In a Wasm environment, a compromised module is limited to exactly the capabilities it was granted, and those are narrow by design.
WASI: System Access Without Ambient Authority
WASI (the WebAssembly System Interface) is the standard that defines how Wasm modules request access to system resources such as files, clocks, environment variables, and network sockets. It is explicitly capability-based. You don’t get access to /tmp just by being a running process; you get a handle to a specific directory, if the host grants one.
This matters for multi-tenant and shared-infrastructure environments. When modules from different teams or applications run on the same host, WASI enforces the isolation between them at the instruction level, not just the process level. There is no /proc to inspect, no shared memory to read, and no syscall interface to exploit.
WASI also makes Wasm portable in a way Docker isn’t. A Docker image built for amd64 can’t run on arm64 without a separate build. A Wasm module compiled once runs identically on any CPU architecture, any operating system, and any environment with a Wasm runtime, including the browser, the edge, an embedded device, or a standard server. The module doesn’t know or care what is underneath it.
Component Interfaces: Communication Without Networking
This is where WebAssembly departs most from the container model.
In Docker, services communicate over the network. They expose HTTP endpoints, speak gRPC, and publish to message queues. All of that requires serialisation: turning data structures into bytes, sending them over TCP, and deserialising them on the other side. It requires service discovery and a network stack, and it adds latency, failure modes, and security surface at every boundary.
The WebAssembly Component Model takes a different approach. Components define their interfaces in WIT (WebAssembly Interface Types), a typed interface definition language that describes what a component exports and what it imports. When one component depends on another, the runtime links them directly. The function call crosses the boundary without going over a network, without being serialised to bytes, and without the usual overhead of service-to-service communication.
interface document-store {
record document {
id: string,
content: string,
}
get: func(id: string) -> option<document>;
save: func(doc: document) -> result<_, string>;
}
This interface is the contract. The implementation can change (the language it is written in, the internal data model, the algorithms) without affecting anything that depends on it. The type system defines the boundary, not an HTTP spec or a protobuf schema that has to be maintained separately.
Compared with the usual alternative of two Docker containers talking over HTTP, this is:
- Faster: no serialisation, no network hop, no connection overhead.
- Safer: the runtime enforces the boundary, instead of relying on both sides handling HTTP correctly.
- More explicit: what a component can access is declared in its interface, not inferred from the port it listens on.
- Versionable: breaking interface changes are caught by the type system at link time, not at runtime.
The Practical Differences
| Docker | WebAssembly | |
|---|---|---|
| Isolation level | Kernel (namespace + cgroup) | Instruction set (sandbox) |
| Default security | Permissive, opt-out | Deny-by-default, opt-in |
| Portability | Per-architecture image | Single binary, any arch |
| Cold start | Seconds | Milliseconds |
| Module size | Tens of MB to GB | Tens of KB to low MB |
| Service communication | Network (HTTP/gRPC/etc.) | Direct typed function calls |
| Interface contract | Implicit (OpenAPI, protobuf) | Explicit (WIT) |
| Host kernel required | Yes | No |
When Docker Is Still the Right Tool
Docker isn’t going away. It is a mature, well-understood technology with a vast ecosystem, and for many use cases it remains the practical choice, particularly for packaging existing applications or running software that was never designed for Wasm.
The tooling around Wasm components is still maturing. Language support varies, and the component model is newer and less widely adopted than containers. Teams evaluating Wasm today are working with a technology that is production-capable, but not yet as familiar to operate as containers are.
What the Model Shift Means
The move from containers to Wasm components is mostly not about performance. It is about what becomes possible when isolation is a built-in property of the execution model instead of something you configure on top of it.
When modules are isolated by design, security policies become a platform concern instead of an application concern. When interfaces are typed and explicit, the platform can generate accurate architecture diagrams, validate dependencies, and enforce contracts at link time. And when communication is direct instead of networked, splitting software into services gets much cheaper, so it becomes practical to build far more modular software without a performance penalty.
You don’t get these by improving containers step by step. They come from starting on a different foundation.
Want to follow our progress?
We're onboarding early design partners and sharing what we learn.
Get Early Access