快速安装containerd和nerdctl

记录节点安装 Containerd 和 Nerdctl 步骤。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Download
# 版本灵活变动
export CONTAINERD_VERSION="1.7.13"
export CNI_PLUGIN_VERSION="v1.4.0"
export RUNC_VERSION="v1.1.11"
export NERDCTL_VERSION="1.7.4"

wget "https://github.com/containerd/containerd/releases/download/v$CONTAINERD_VERSION/containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz"
wget "https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGIN_VERSION/cni-plugins-linux-amd64-$CNI_PLUGIN_VERSION.tgz"
wget -O /usr/local/bin/runc "https://github.com/opencontainers/runc/releases/download/$RUNC_VERSION/runc.amd64"
wget "https://github.com/containerd/nerdctl/releases/download/v$NERDCTL_VERSION/nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz"

# Install
tar Czvxf /usr/local containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz
mkdir -pv /opt/cni/bin && tar Czvxf /opt/cni/bin cni-plugins-linux-amd64-$CNI_PLUGIN_VERSION.tgz
chmod 755 /usr/local/bin/runc
tar Czvxf /usr/local/bin nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz

# Config
mkdir -pv /etc/containerd
containerd config default > /etc/containerd/config.toml
vim /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."k8s.gcr.io"]
endpoint = ["https://k8s-gcr.m.daocloud.io"]
...

# Enable
mkdir -pv /usr/local/lib/systemd/system
wget -P /usr/local/lib/systemd/system "https://raw.githubusercontent.com/containerd/containerd/v$CONTAINERD_VERSION/containerd.service"
systemctl daemon-reload
systemctl enable containerd --now

# Try to use
nerdctl info
Author

Warner Chen

Posted on

2024-02-29

Updated on

2026-04-15

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.
You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.