参考官网:https://github.com/containerd/containerd/blob/main/docs/getting-started.md
1.安装containerd
containerd-<VERSION>-<OS>-<ARCH>.tar.gz
从https://github.com/containerd/containerd/releases下载存档,验证其 sha256sum,并将其解压到/usr/local
:
$ wget https://github.com/containerd/containerd/releases/download/v1.7.2/containerd-1.7.2-linux-amd64.tar.gz
$ tar -zxvf containerd-1.7.2-linux-amd64.tar.gz -C /usr/local/
bin/
bin/containerd-shim-runc-v1
bin/containerd-shim-runc-v2
bin/containerd-stress
bin/containerd
bin/containerd-shim
bin/ctr
2.配置systemd 启动
从 https://raw.githubusercontent.com/containerd/containerd/main/containerd.service下载单元文件到/usr/lib/systemd/system/containerd.service
,并运行以下命令:
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
cp ./containerd.service /usr/lib/systemd/system/
#加载systemd的配置文件,使之生效
systemctl daemon-reload
#开机自启并立即启动该服务
systemctl enable --now containerd
3.安装 runc
runc.<ARCH>
从https://github.com/opencontainers/runc/releases下载二进制文件,验证其 sha256sum,并将其安装为/usr/local/sbin/runc
.
wget https://github.com/opencontainers/runc/releases/download/v1.1.7/runc.amd64
install -m 755 runc.amd64 /usr/local/sbin/runc
4.安装CNI插件
cni-plugins-<OS>-<ARCH>-<VERSION>.tgz
从https://github.com/containernetworking/plugins/releases下载存档,验证其 sha256sum,并将其解压到/opt/cni/bin
:
$ mkdir -p /opt/cni/bin
$ tar zxvf cni-plugins-linux-amd64-v1.3.0.tgz -C /opt/cni/bin/
./
./loopback
./bandwidth
./ptp
./vlan
./host-device
./tuning
./vrf
./sbr
./tap
./dhcp
./static
./firewall
./macvlan
./dummy
./bridge
./ipvlan
./portmap
./host-local
5.查看安装版本
$ ctr version
Client:
Version: v1.7.2
Revision: 0cae528dd6cb557f7201036e9f43420650207b58
Go version: go1.20.4
Server:
Version: v1.7.2
Revision: 0cae528dd6cb557f7201036e9f43420650207b58
UUID: 1b59701c-c02a-42cb-89ed-f8b201c76e2f