shimkit
Library for writing containerd shims
Task API
Setup
-
Build the logger example
-
Create an executable script to print the path to the shim server
-
Then run the shim
Start a container
Now in a different terminal start a container with docker run
The command will fail because the logger shim is just a stub, but you will see the requests that containerd did on the shim printed to the terminal.
Sandbox API
Setup
- If you haven't, follow the setup in steps in Task API
- Enable containerd's sandbox API by setting the environent variable
ENABLE_CRI_SANDBOXES=sandboxedwhen launching containerd. If you use systemd edit/usr/lib/systemd/system/containerd.serviceand in the[Service]section addEnvironment=ENABLE_CRI_SANDBOXES=sandboxed.... [Service] ExecStartPre=-/user/bin/modprobe overlay ExecStart=/usr/bin/containerd Environment=ENABLE_CRI_SANDBOXES=sandboxed ... - Add the runtime to containerd's
config.tomlfile/etc/containerd/config.toml. If the file doesn't exist, create it. A minimal example below:= 2 [] = "io.containerd.logger.v1" = "shim" [] = "io.containerd.runc.v2" - Restart containerd. If you use systemd
Start a sandbox
Now start a new sandbox using crictl runp
The command will fail because the logger shim is just a stub, but you will see the requests that containerd did on the shim printed to the terminal.