Containerd作为容器运行时可以用的指令本文介绍:最近Kubernetes1.24版本发布了,随之去除了docker-shim组件,容器运行时改为containerd,所以打算发布以下containerd在k8s中常用操作
可以使用的指令包括ctr、crictl、nerdctl,其中ctr是安装containerd自带的可执行指令,crictl、nerdctl命令是比较接近docker命令,也是社区所提供的
Containerd常用命令1.查看容器运行状态
# 1.ctr ctr container ls #指定命名空间 ctr --namespace=k8s.io container ls # 2.crictl crictl ps # 3.nerdctl nerdctl ps
2.查看镜像
# 1.ctr ctr image ls #指定命名空间 ctr --namespace=k8s.io image ls # 2.crictl crictl image # 3.nerdctl nerdctl image
3.查看容器日志
# 1.ctr 没有相关命令 # 2.crictl crictl logs # 3.nerdctl nerdctl logs
4.修改镜像标签
# 1.ctr ctr image tag # 2.crictl 没有相关命令 # 3.nerdctl nerdctl tag
5.导出镜像
# 1.ctr ctr image export # 2. crictl 没有相关命令 # 3.nerdctl nerdctl save
6.导入镜像
# 1.ctl ctr image import # 2.crictl 没有相关命令 # 3.nerdctl nerdctl load
7.删除镜像
# 1.ctr ctr image rm # 2.crictl crictl rmi #3. nerdctl nerdctl rmi
8.拉取镜像
# 1.ctr ctr image pull # 2.crictl crictl pull # 3.nerdctl nerdctl pull
9.推送镜像
# 1.ctr ctr image push # 2.crictl 没有相关命令 # 3.nerdctl nerdctl push
以上是containerd在k8s中常用操作。



