![image-20220429223702975](https://bucket-hg.oss-cn-shanghai.aliyuncs.com/img/image-20220429223702975.png)
当前环境
node1上有docker.io/prom/prometheus:v2.34.0
镜像,但k8s-master上没有这个镜像,此时想把node1上的这个镜像直接导出到本地,然后再导入到k8s-master1上。
[root@node1 ~]#ctr -n k8s.io i ls |grep prometheus
docker.io/prom/prometheus:v2.34.0 application/vnd.docker.distribution.manifest.list.v2+json sha256:b37103e03399e90c9b7b1b2940894d3634915cf9df4aa2e5402bd85b4377808c 74.4 MiB linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x io.cri-containerd.image=managed
docker.io/prom/prometheus@sha256:b37103e03399e90c9b7b1b2940894d3634915cf9df4aa2e5402bd85b4377808c application/vnd.docker.distribution.manifest.list.v2+json sha256:b37103e03399e90c9b7b1b2940894d3634915cf9df4aa2e5402bd85b4377808c 74.4 MiB linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x io.cri-containerd.image=managed
[root@master1 ~]#ctr -n k8s.io i ls |grep prometheus
[root@master1 ~]#
1、导出镜像
[root@node1 ~]#ctr -n k8s.io i export prometheus.v2.34.0.tar.gz docker.io/prom/prometheus:v2.34.0
2、导入镜像
[root@master1 ~]#ctr -n k8s.io i import prometheus.v2.34.0.tar.gz
结论
-IORgMIb3-1651243065724)]
结论
在k8s集群,运行时是containerd时,完全可以使用containerd自带的
ctr命令
进行操作容器及镜像!