目前nerdctl最新版是1.2.1, containerd 1.6.19
nerdctl-full-1.2.1中包含了containerd 1.6.19,cni, nerdctl,所以直接下載這個包即可,如果nerdctl有更新,可以把以下代碼中的1.2.1替換為對應版本號即可
對於root用戶
wget https://ghproxy.com/https://github.com/containerd/nerdctl/releases/download/v1.2.1/nerdctl-full-1.2.1-linux-amd64.tar.gz tar Cxzvf /usr/local nerdctl-full-1.2.1-linux-amd64.tar.gz cp /usr/local/lib/systemd/system/*.service /etc/systemd/system/ systemctl enable buildkit containerd systemctl start buildkit containerd
對於非root用戶
wget https://ghproxy.com/https://github.com/containerd/nerdctl/releases/download/v1.2.1/nerdctl-full-1.2.1-linux-amd64.tar.gz
sudo tar Cxzvf /usr/local nerdctl-full-1.2.1-linux-amd64.tar.gz
containerd-rootless-setuptool.sh install
注意,這個rootless-setuptool目前不支持centOS 7及其以下。
完成后nerdctl的使用方法就和docker基本一致
nerdctl compose與docker-compose 用法基本一致