Skip to content

Minimum runc shim implementation #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ members = [
"crates/shim-protos",
"crates/shim",
"crates/snapshots",
"crates/runc"
"crates/runc",
"crates/runc-shim",
]
24 changes: 24 additions & 0 deletions crates/runc-shim/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "containerd-shim-runc-v2"
version = "0.1.0"
authors = ["Shaobao Feng <fshb1988@gmail.com>", "Tianyang Zhang <burning9699@gmail.com>"]
edition = "2018"
license = "Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
async = []

[dependencies]
containerd-shim = { path = "../shim", version = "0.2.0" }
nix = "0.23.1"
time = { version = "0.3.7", features = ["serde", "std"] }
serde = { version = "1.0.133", features = ["derive"] }
serde_json = "1.0.74"
oci-spec = "0.5.4"

runc = { path = "../runc", version = "0.1.0" }

[profile.release]
panic = 'abort'
14 changes: 14 additions & 0 deletions crates/runc-shim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Rust containerd shim v2 for runc container

This is a binary crate that provides a containerd shim for runc container.

## Usage

To build binary, run:
```shell
cargo build --release
```

Replace it to the containerd shim dir: `/usr/local/bin/containerd-shim-runc-v2`

You can run a container by `ctr`, `crictl` or kubernetes API.
23 changes: 23 additions & 0 deletions crates/runc-shim/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright The containerd Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
mod runc;
mod service;

use crate::service::Service;

fn main() {
containerd_shim::run::<Service>("io.containerd.runc.v2", None)
}
Loading