Prerequisites:
- Linux OS (I think you can get this running within a container on Docker Desktop, BUT if you need to compile...)
- containerd 1.7.7+ moved to
/usr/bin
and - update the
/etc/containerd/config.toml
file with the Spin v2 runtime:
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "io.containerd.spin.v2"
alias killshim='sudo ctr --address /tmp/containerd-temp.sock task kill $1 --all --signal 9'
alias ctr='sudo ctr --address /tmp/containerd-temp.sock'
alias containerd='sudo containerd --address /tmp/containerd-temp.sock'
- clone the Spin shim:
$ git clone https://github.com/spinkube/containerd-shim-spin
- build the Spin shim for your current architecture:
$ cargo build --release
- move the binary to
/usr/bin
:
$ sudo mv target/release/containerd-shim-spin-v2 /usr/bin
- start containerd (on a separate socket so it doesn't interfere with your Docker setup -- see the aliases section):
$ containerd
- pull the Spin application locally from the OCI registry:
$ ctr image pull ttl.sh/spin-perf:24h
- start the application locally using
ctr
:
$ ctr run --rm --net-host --runtime io.containerd.spin.v2 ttl.sh/spin-perf:24h perf nonexistent-required-entrypoint-arg
Serving http://0.0.0.0:80
Available Routes:
perf: http://0.0.0.0:80 (wildcard)
-
the application is accessible on port 80 because we're using the host network
-
stopping an application running with the shim requires passing the
--signal 9
(ongoing issue in runwasi):
# killshim <name of task>
$ killshim perf
In the /usr/bin
directory you need the following binaries:
40M 4 months /usr/bin/containerd
6.4M 4 months /usr/bin/containerd-shim
8.1M 4 months /usr/bin/containerd-shim-runc-v1
12M 4 months /usr/bin/containerd-shim-runc-v2
43M 4 days /usr/bin/containerd-shim-spin-v2
19M 4 months /usr/bin/containerd-stress
20M 4 months /usr/bin/ctr
I had success today using a lima vm (on my M1 mac) for building/testing the shim.
Here's the lima vm config (based on their ubuntu-lts template):
Then the steps I followed: