7 releases (breaking)

0.6.0 Oct 30, 2023
0.5.0 Aug 24, 2023
0.4.0 Aug 2, 2023
0.3.0 Apr 14, 2023
0.1.2 Dec 30, 2021

#173 in Asynchronous

Download history 2015/week @ 2023-08-11 2209/week @ 2023-08-18 1670/week @ 2023-08-25 1921/week @ 2023-09-01 1970/week @ 2023-09-08 2394/week @ 2023-09-15 1389/week @ 2023-09-22 921/week @ 2023-09-29 1565/week @ 2023-10-06 1441/week @ 2023-10-13 1651/week @ 2023-10-20 2213/week @ 2023-10-27 2135/week @ 2023-11-03 1810/week @ 2023-11-10 1386/week @ 2023-11-17 992/week @ 2023-11-24

6,585 downloads per month
Used in 3 crates (via containerd-shim)


341 lines

Shim protos and client for containerd

Crates.io docs.rs Crates.io CI

containerd-shim-protos contains TTRPC bindings and client/server code to interact with containerd's runtime v2 shims.


This crate is mainly expected to be useful to interact with containerd's shim runtime. Runtime v2 introduces a first class shim API for runtime authors to integrate with containerd. The shim API is minimal and scoped to the execution lifecycle of a container.

To learn how containerd's shim v2 runtime works in details, please refer to the documentation.


The containerd-shim-protos crate provides Protobuf message and TTRPC service definitions for the Containerd shim v2 protocol.

The message and service definitions are auto-generated from protobuf source files under vendor/ by using ttrpc-codegen. So please do not edit those auto-generated source files.

If upgrading/modification is needed, please follow the steps:

  • Synchronize the latest protobuf source files from the upstream projects into directory 'vendor/'.
  • Re-generate the source files by cargo build --features=generate_bindings.
  • Commit the synchronized protobuf source files and auto-generated source files, keeping them in synchronization.


Add containerd-shim-client as a dependency in your Cargo.toml

containerd-shim-protos = "0.4"

Basic client code looks as follows:

use containerd_shim_protos as client;

let client = client::Client::connect("unix:///containerd-shim/shim.sock").expect("Failed to connect to shim");
let task_client = client::TaskClient::new(client);

let context = client::ttrpc::context::with_timeout(0);

let req = client::api::ConnectRequest {
    id: String::from("1"),

let resp = task_client.connect(context, &req).expect("Connect request failed");


The way to build the example:

# build sync connect, client and server
$ cargo build --example shim-proto-connect
$ sudo ./shim-proto-connect unix:///containerd-shim/shim_socket_path.sock
$ cargo build --example shim-proto-client
$ cargo build --example shim-proto-server

# build async connect, client and server
$ cargo build --example shim-proto-connect-async --features async
$ cargo build --example shim-proto-client-async --features async
$ cargo build --example shim-proto-server-async --features async


~178K SLoC