Skip to content

Commit 2794e1f

Browse files
committed
Runc shim implementation
1 parent 7a55e0f commit 2794e1f

File tree

42 files changed

+4205
-492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4205
-492
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ members = [
55
"crates/shim-protos",
66
"crates/shim",
77
"crates/snapshots",
8-
"crates/runc"
8+
"crates/runc",
9+
"crates/runc-shim",
910
]

crates/runc-shim/Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "containerd-shim-runc-v2"
3+
version = "0.1.0"
4+
authors = ["Shaobao Feng <fshb1988@gmail.com>", "Tianyang Zhang <burning9699@gmail.com>"]
5+
edition = "2018"
6+
license = "Apache-2.0"
7+
8+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9+
10+
[features]
11+
async = []
12+
13+
[dependencies]
14+
containerd-shim = { path = "../shim", version = "0.2.0" }
15+
nix = "0.23.1"
16+
time = { version = "0.3.7", features = ["serde", "std"] }
17+
log = { version = "0.4.11", features = ["std"] }
18+
serde = { version = "1.0.133", features = ["derive"] }
19+
serde_json = "1.0.74"
20+
runc = { path = "../runc", version = "0.1.0" }
21+
oci-spec = "0.5.4"
22+
23+
[profile.release]
24+
panic = 'abort'

crates/runc-shim/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Rust containerd shim v2 for runc container
2+
3+
This is a binary crate that provides a containerd shim for runc container.
4+
5+
## Usage
6+
7+
To build binary, run:
8+
```shell
9+
cargo build --release
10+
```
11+
12+
Replace it to the containerd shim dir: `/usr/local/bin/containerd-shim-runc-v2`
13+
14+
You can run a container by `ctr`, `crictl` or kubernetes API.

crates/runc-shim/src/main.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#[macro_use]
18+
extern crate containerd_shim;
19+
20+
#[macro_use]
21+
extern crate log;
22+
23+
mod runc;
24+
mod service;
25+
26+
use crate::service::Service;
27+
28+
fn main() {
29+
containerd_shim::run::<Service>("io.containerd.runc.v2", Vec::new())
30+
}

0 commit comments

Comments
 (0)