containerd
sudo systemctl enable --now containerd
nerdctl
containerd 自带的 ctr 命令用不习惯,可以安装 nerdctl ,nerdctl 命令同 docker 风格一致的 containerd 客户端工具.
# 安装
wget https://github.com/containerd/nerdctl/releases/download/v1.7.6/nerdctl-1.7.6-linux-amd64.tar.gz
tar -zxvf nerdctl-1.7.6-linux-amd64.tar.gz
cp nerdctl /usr/local/bin/
# 测试,如果没有安装 buildkit 会提示没有 buildctl 命令
nerdctl version
# 使用
nerdctl ps
nerdctl images
buildkit
nerdctl build:从 Dockerfile 构建镜像,需要安装 buildkit
wget https://github.com/moby/buildkit/releases/download/v0.9.0/buildkit-v0.9.0.linux-amd64.tar.gz
tar -zxvf buildkit-v0.9.0.linux-amd64.tar.gz
# 将解压出来的 bin 文件全部复制
cp bin/* /usr/local/bin/
使用 Systemd 来管理 buildkitd, cat /etc/systemd/system/buildkit.service
[Unit]
Description=BuildKit
Documentation=https://github.com/moby/buildkit
[Service]
ExecStart=/usr/local/bin/buildkitd --oci-worker=false --containerd-worker=true
[Install]
WantedBy=multi-user.target
启动/停止
systemctl daemon-reload
systemctl enable --now buildkit
systemctl status buildkit