Fork me on GitHub

wctr commands,
WASI containers.

A container here is a WebAssembly module. The wctrd daemon listens on /var/run/wctr.sock and is compatible with the Docker Engine API; wctr is the command a lab teaches and the learner types; the image is an OCI image with os=wasip1 and arch=wasm, run by wazero instead of a Linux kernel. Engine v0.1.0 is released: native, no networking yet. Pure Go, CGO_ENABLED=0. BSD-3-Clause.

wasip1 images, OCI-compatiblev0.1.0 released (M1)CGO=0 pure Go
wctr โ€” zsh
# engine v0.1.0, the engine's acceptance test
$ wctr pull oci:./layout:hello
Pulling from oci:/home/me/layout:hello
f0beefb89ff1: Pull complete
Digest: sha256:da3eead2a4f462a53bebdee2f9dc5fcb94cc5a97ebe1680477f0ce0328ff67f0
Status: Downloaded newer image for hello:latest
$ wctr run --rm hello
Hello from a WebAssembly container!
$ wctr run --rm -e NAME=x greet
Hello, x!
$ wctr run --name failing probe exit 42
bye
$ echo $?
42
$ wctr images
REPOSITORY   TAG      IMAGE ID       CREATED        SIZE
greet        latest   068beee4f451   12 hours ago   2.45MB
hello        latest   85c424cd2beb   12 hours ago   735kB
probe        latest   ae7fb9d7cefb   12 hours ago   811kB

# planned, not started
$ wctr exec -it <container> sh
$ wctr build .
$ wctr compose up
7 things on the roadmap โ€” all of them planned, none shipped yet
Why go-wasmcontainers

A lab should be a web page, not a virtual machine.

Teaching containers usually means provisioning a Linux machine per learner. WASI modules need no kernel, so the same engine that runs natively can, in the plan, run in a browser worker.

๐Ÿ”Œ

Compatible with the Docker Engine API

wctrd answers that API (v1.47 is the version its reference is read from) on /var/run/wctr.sock, and WCTR_HOST points wctr elsewhere. Learners type wctr commands, whose shape is the one they know from containers at work.

๐ŸงŠ

WASI images

An image is an OCI image whose platform is os=wasip1, arch=wasm; the layer is a module. Images are meant to be apt-like, built from pkgx wasip1 bottles โ€” a target go-pkgx is gaining now.

โš™๏ธ

wazero executor

Containers run in wazero, a pure-Go WebAssembly runtime: no cgo, no kernel namespaces, one static binary.

๐ŸŒ

Planned: the browser

The playground is a terminal running wctr against WASI containers, entirely in a page. It has not been started; it depends on the executor running in a browser worker.

Repositories

Two repositories, one engine.

engine v0.1.0 released

The wctrd daemon and the wctr command: a container engine for WASI (wasip1) workloads, compatible with the Docker Engine API, in pure Go. v0.1.0 (milestone M1) runs natively on Linux and macOS with a wazero executor: wctr pull, images, run, ps, logs, rm, rmi, inspect, kill and version, against an OCI image layout or a registry. No networking, exec, attach or build yet. Install with go install github.com/go-wasmcontainers/engine/cmd/wctr@v0.1.0 (and cmd/wctrd).

playground planned

An in-browser container playground: a terminal that runs wctr against WASI containers, for cloud and container training labs. Not started: it needs the engine’s executor to run in a browser worker.

Roadmap

What is planned, and only that.

Nothing below exists yet. It is listed so a reader can tell what engine v0.1.0 does not do: no networking, exec, attach or build; no tar+zstd layers; containers are lost when wctrd restarts.

Networking planned

Containers that listen and connect, through the WasmEdge socket ABI.

Classroom relay planned

Planned: a classroom relay with security groups. Students’ browsers reach each other’s containers through a relay on the teacher’s laptop that is also a firewall, with rules modelled on OpenStack Neutron and a gRPC control API. Design.

A shell and exec planned

wctr exec and an interactive shell, through a WASIX subset.

Image build planned

Building an image from a Dockerfile.

Compose planned

Several containers described in one file.

A mini-Kubernetes planned

Enough of the orchestrator’s API to teach its concepts.

Browser executor planned

The same executor model in a browser worker, which is what the playground needs.

2
repositories: the engine and the playground
3.4 ms
warm container start on one core (cold 610 ms); not yet compared to a reference runtime
7
roadmap items, all planned
1
release: engine v0.1.0, with go install github.com/go-wasmcontainers/engine/cmd/wctr@v0.1.0

Containers that ship like Go.

No cgo, no daemon written in C, no kernel to provision. Every behaviour that follows a specification โ€” OCI image and distribution, registry token authentication, the Docker Engine API it is compatible with, the wasm OCI artifact layout, WASI preview1 โ€” is written against the document it follows, and the engine's references page says which version was opened.

Read the source on GitHub โ†’