-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## How to run a Docker wasm container | ||
|
||
Step zero is creating/modifing your `/etc/docker/daemon.json` file, adding this feature: | ||
|
||
```json | ||
{ | ||
"features": { | ||
"containerd-snapshotter": true | ||
} | ||
} | ||
``` | ||
Save, close and restart docker: | ||
|
||
```bash | ||
systemctl restart docker | ||
``` | ||
|
||
First step is compiling the containerd-shim-wasmtime that we will use later as runtime in docker. | ||
|
||
```bash | ||
docker build --output . - <<EOF | ||
FROM rust:1.70.0 as build | ||
RUN apt-get update -y | ||
RUN apt-get install protobuf-compiler libdbus-1-dev pkg-config -y | ||
RUN cargo install \ | ||
--git https://github.com/mfranzon/runwasi.git \ | ||
--branch oci-artifacts \ | ||
--bin containerd-shim-wasmtime-v1 \ | ||
--root /out \ | ||
containerd-shim-wasmtime | ||
FROM scratch | ||
COPY --from=build /out/bin / | ||
EOF | ||
``` | ||
|
||
Second step, move the executable into an exported PATH like `/usr/local/bin` | ||
|
||
```bash | ||
mv ./containerd-shim-wasmtime-v1 /usr/local/bin | ||
``` | ||
|
||
Last step, enjoy your docker wasm | ||
|
||
```bash | ||
docker run --runtime=io.containerd.wasmtime.v1 --platform wasi/wasm32 rumpl/wasmtest echo 'hello from wasm' | ||
``` | ||
|