5 releases (3 breaking)

0.5.0 Mar 20, 2024
0.4.0 Nov 1, 2023
0.2.1 Aug 3, 2023
0.1.2 Mar 7, 2023

#160 in WebAssembly

Download history 11/week @ 2024-02-21 5/week @ 2024-02-28 3/week @ 2024-03-06 3/week @ 2024-03-13 174/week @ 2024-03-20 46/week @ 2024-03-27 100/week @ 2024-04-03 80/week @ 2024-04-10 41/week @ 2024-04-17 27/week @ 2024-04-24 19/week @ 2024-05-01 18/week @ 2024-05-08

114 downloads per month

Apache-2.0

305KB
4.5K SLoC

runwasi logo

containerd-shim-wasm

A library to help build containerd shims for wasm workloads.

Usage

use containerd_shim as shim;
use containerd_shim_wasm::sandbox::{ShimCli, Instance, Nop}

fn main() {
    shim::run::<ShimCli<Nop>>("io.containerd.nop.v1", opts);
}

The above example uses the built-in Nop instance which does nothing. You can build your own instance by implementing the Instance trait.

use containerd_shim as shim;
use containerd_shim_wasm::sandbox::{ShimCli, Instance}

struct MyInstance {
 // ...
}

impl Instance for MyInstance {
    // ...
}

fn main() {
    shim::run::<ShimCli<MyInstance>>("io.containerd.myshim.v1", opts);
}

containerd expects the shim binary to be installed into $PATH (as seen by the containerd process) with a binary name like containerd-shim-myshim-v1 which maps to the io.containerd.myshim.v1 runtime which would need to be configured in containerd. It (containerd) also supports specifying a path to the shim binary but needs to be configured to do so.

This crate is not tied to any specific wasm engine.

Dependencies

~32–48MB
~797K SLoC