Skip to content

Commit

Permalink
feat: Begin with containerd
Browse files Browse the repository at this point in the history
  • Loading branch information
adityahase committed Sep 9, 2024
1 parent d7ee989 commit 4482a1e
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
62 changes: 62 additions & 0 deletions containers/containerd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Installing containerd + nerdctl
This guide installs latest versions (RC) of containerd, runc and nerdctl

https://github.com/containerd/containerd/releases/tag/v2.0.0-rc.4
https://github.com/containerd/nerdctl/releases/tag/v2.0.0-rc.1
https://github.com/opencontainers/runc/releases/tag/v1.2.0-rc.3
https://github.com/containernetworking/plugins/releases/tag/v1.5.1

#### Step 1: Installing containerd
Download https://github.com/containerd/containerd/releases/download/v2.0.0-rc.4/containerd-2.0.0-rc.4-linux-amd64.tar.gz
```sh
wget https://github.com/containerd/containerd/releases/download/v2.0.0-rc.4/containerd-2.0.0-rc.4-linux-amd64.tar.gz
```
Extract it under `/usr/local`
```sh
sudo tar Cxzvf /usr/local containerd-2.0.0-rc.4-linux-amd64.tar.gz
```
#### Setup systemd
Download the containerd.service unit file from
https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
into /etc/systemd/system/containerd.service

```shell
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
sudo mv containerd.service /etc/systemd/system/containerd.service
sudo systemctl daemon-reload
sudo systemctl enable --now containerd
```

#### Step 2: Installing runc

Download the `runc.amd64` binary from https://github.com/opencontainers/runc/releases/download/v1.2.0-rc.3/runc.amd64 and install it in `/usr/local/sbin`.

```shell
wget https://github.com/opencontainers/runc/releases/download/v1.2.0-rc.3/runc.amd64
```

```shell
sudo install -m 755 runc.amd64 /usr/local/sbin/runc
```

#### Step 3: Installing cni plugins
Download https://github.com/containernetworking/plugins/releases/download/v1.5.1/cni-plugins-linux-amd64-v1.5.1.tgz and extract it under `/opt/cni/bin`

```shell
wget https://github.com/containernetworking/plugins/releases/download/v1.5.1/cni-plugins-linux-amd64-v1.5.1.tgz
```

```shell
sudo mkdir -p /opt/cni/bin
sudo tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.5.1.tgz
```

#### Step 3: Installing nerdctl
Download https://github.com/containerd/nerdctl/releases/download/v2.0.0-rc.1/nerdctl-2.0.0-rc.1-linux-amd64.tar.gz and extract it under `/usr/local/bin`
```shell
wget https://github.com/containerd/nerdctl/releases/download/v2.0.0-rc.1/nerdctl-2.0.0-rc.1-linux-amd64.tar.gz
```

```shell
sudo tar Cxzvf /usr/local/bin nerdctl-2.0.0-rc.1-linux-amd64.tar.gz
```
16 changes: 16 additions & 0 deletions containers/grpc_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# containerd gRPC example

This relies on https://github.com/siemens/pycontainerd
```sh
pip3 install containerd
```

```shell
sudo env/bin/python apps/pilot/containers/grpc_demo/example.py
```
You should see something like
```shell
namespace: default
```

Note: You'll need sudo here because `/run/containerd/containerd.sock` is accessible to root. rootless containers might solve this problem, but we'll ignore that problem for now.
8 changes: 8 additions & 0 deletions containers/grpc_demo/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import grpc
from containerd.services.namespaces.v1 import namespace_pb2, namespace_pb2_grpc

with grpc.insecure_channel("unix:///run/containerd/containerd.sock") as channel:
namespacev1 = namespace_pb2_grpc.NamespacesStub(channel)
namespaces = namespacev1.List(namespace_pb2.ListNamespacesRequest()).namespaces
for namespace in namespaces:
print("namespace:", namespace.name)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies = [
# Terraform CDKTF dependencies
"cdktf==0.20.8",
"cdktf-cdktf-provider-digitalocean==11.5.2",
"containerd==1.5.3",
]

[build-system]
Expand Down

0 comments on commit 4482a1e

Please sign in to comment.