WASM and Docker
Antonis Kalipetis
@akalipetis
Docker Athens | #DockerAth
👋 I’m Antonis
* Software Engineer at Platform.sh
* DevOps with LOGIC
* Docker Captain
* One half of mikrikouventa.fm
* Python lover and Go developer
* Docker and Containers aficionado
* Everything that comes to my hands becomes a container
🎯 Goals for the day
* Better understand WASM
* See how WASM plays with Docker
* Explore the future of containers and WASM
What is WASM?
* WASM stands for WebAssembly
* WASM is a binary instruction format for a stack-based
virtual machine
* It was initially meant as a way to ship code in the web
browser, other than JS
🤨 What is WASM?
* An efficient and fast way to compile and package
applications written in a variety of languages
* A way to run those application into sandboxed
environments, either in the browser or elsewhere
* An application format that can run in the same way between
different environments, from edge servers to your browser
and inside other applications
💡 What is WASM today?
* WASM is currently supported by all major web browsers,
including Chrome, Firefox, and Safari
* The standard is owned by W3C
* Originally created to provide near-native speed code
execution in the browser
🕸 The Web in WebAssembly
* Figma was written in WASM
* CloudFlare workers run WASM
* There was also WASM in Marathon’s latest Compensation
Report
📸 WASM highlights
WASM
And
Docker
🐳 Docker Desktop and WASM
Docker Engine
containerd-shim
runc
Container process
containerd-shim
runc
Container process
containerd-wasm
-shim
wasmedge
Wasm Module
DEMO TIME!
* We built a Docker image using a Dockerfile, where the
application was compiled from Rust code ⚙ into WASM
* The .wasm application was copied to a SCRATCH image
* WASM and normal containers were started, using the same
network
🧵 What did just happen there?
* Boundaries are very constraint by design
* WASI is being developed to provide a standardized
interface for interacting with system resources
* containerd has support for running different types of WASI
interfaces
https://github.com/containerd/runwasi
🏺 How are the applications contained?
* Very fast startup time (ms)
* Single application for all
architectures/OSes
* Restrictive on the type of code
you can run
* Fast startup time
* One image for each
architecture/OS
* Run everything a Linux machine
can run
🥊 WASM vs Containers
* Manage large amounts of WASM containers
* Run untrusted code with very specific boundaries
* Easily install plugins to CLIs or other desktop
applications
🔮 What could the future look like?
* OCI images are a great packaging format
* containerd is a great tool for managing workloads
* There are multiple orchestrators orchestrating workloads
that run with containerd
❓ Docker, containers and WASM a few months in
Connect the dots…
Questions?
Thanks!
Antonis Kalipetis
@akalipetis

Docker and WASM

  • 1.
    WASM and Docker AntonisKalipetis @akalipetis Docker Athens | #DockerAth
  • 2.
    👋 I’m Antonis *Software Engineer at Platform.sh * DevOps with LOGIC * Docker Captain * One half of mikrikouventa.fm * Python lover and Go developer * Docker and Containers aficionado * Everything that comes to my hands becomes a container
  • 3.
    🎯 Goals forthe day * Better understand WASM * See how WASM plays with Docker * Explore the future of containers and WASM
  • 5.
  • 6.
    * WASM standsfor WebAssembly * WASM is a binary instruction format for a stack-based virtual machine * It was initially meant as a way to ship code in the web browser, other than JS 🤨 What is WASM?
  • 7.
    * An efficientand fast way to compile and package applications written in a variety of languages * A way to run those application into sandboxed environments, either in the browser or elsewhere * An application format that can run in the same way between different environments, from edge servers to your browser and inside other applications 💡 What is WASM today?
  • 8.
    * WASM iscurrently supported by all major web browsers, including Chrome, Firefox, and Safari * The standard is owned by W3C * Originally created to provide near-native speed code execution in the browser 🕸 The Web in WebAssembly
  • 9.
    * Figma waswritten in WASM * CloudFlare workers run WASM * There was also WASM in Marathon’s latest Compensation Report 📸 WASM highlights
  • 10.
  • 11.
    🐳 Docker Desktopand WASM Docker Engine containerd-shim runc Container process containerd-shim runc Container process containerd-wasm -shim wasmedge Wasm Module
  • 12.
  • 13.
    * We builta Docker image using a Dockerfile, where the application was compiled from Rust code ⚙ into WASM * The .wasm application was copied to a SCRATCH image * WASM and normal containers were started, using the same network 🧵 What did just happen there?
  • 14.
    * Boundaries arevery constraint by design * WASI is being developed to provide a standardized interface for interacting with system resources * containerd has support for running different types of WASI interfaces https://github.com/containerd/runwasi 🏺 How are the applications contained?
  • 15.
    * Very faststartup time (ms) * Single application for all architectures/OSes * Restrictive on the type of code you can run * Fast startup time * One image for each architecture/OS * Run everything a Linux machine can run 🥊 WASM vs Containers
  • 16.
    * Manage largeamounts of WASM containers * Run untrusted code with very specific boundaries * Easily install plugins to CLIs or other desktop applications 🔮 What could the future look like?
  • 17.
    * OCI imagesare a great packaging format * containerd is a great tool for managing workloads * There are multiple orchestrators orchestrating workloads that run with containerd ❓ Docker, containers and WASM a few months in
  • 18.
  • 19.
  • 20.