参考:https://www.cnblogs.com/vmsky/p/16294864.html
#查看命名空间
ctr namespaces ls
#查看镜像列表
ctr -n k8s.io image ls
#给镜像打标签
[root@k8s-m1 ~]# ctr -n k8s.io images ls|grep nginx
docker.io/library/nginx:alpine
[root@k8s-m1 ~]# ctr -n k8s.io images tag docker.io/library/nginx:alpine harbor.cicd.ltd/library/nginx:alpine
harbor.cicd.ltd/library/nginx:alpine
# push 上传镜像
[root@k8s-m1 ~]# ctr -n k8s.io images push harbor.cicd.ltd/library/nginx:alpine
# 注意可能会出现 ctr: content digest sha256:xxxxxx not found,解决办法,下载完整的
![](/i/l/?n=22&i=blog/1326813/202205/1326813-20220521125303408-1930568624.png)
[root@k8s-m1 ~]# ctr -n k8s.io image pull --all-platforms docker.io/library/nginx:alpine
[root@k8s-m1 ~]# ctr -n k8s.io images rm harbor.cicd.ltd/library/nginx:alpine
[root@k8s-m1 ~]# ctr -n k8s.io images tag docker.io/library/nginx:alpine harbor.cicd.ltd/library/nginx:alpine
#导入镜像,
ctr image import stmp.tar
可以加上-n k8s.io这个namespace
ctr -n k8s.io image import stmp.tar
#ctr工具导出镜像命令
ctr images export stmp.tar
# 拉取镜像
ctr -n k8s.io image pull docker.io/library/nginx:alpine
# 删除镜像
ctr -n k8s.io images rm k8s.gcr.io/pause:3.2
标签:ctr,nginx,library,命令,io,k8s,alpine
From: https://www.cnblogs.com/regit/p/17846695.html