镜像操作笔记

containerd环境

查看当前主机镜像列表

sudo ctr -n k8s.io images ls | grep ingress

查询镜像内容

sudo ctr -n k8s.io images mount --help
NAME:
   ctr images mount - mount an image to a target path

USAGE:
   ctr images mount [command options] [flags] <ref> <target>

DESCRIPTION:
   Mount an image rootfs to a specified path.

When you are done, use the unmount command.


OPTIONS:
   --skip-verify, -k       skip SSL certificate validation
   --plain-http            allow connections using plain HTTP
   --user value, -u value  user[:password] Registry user and password
   --refresh value         refresh token for authorization server
   --hosts-dir value       Custom hosts configuration directory
   --tlscacert value       path to TLS root CA
   --tlscert value         path to TLS client certificate
   --tlskey value          path to TLS client key
   --http-dump             dump all HTTP request/responses when interacting with container registry
   --http-trace            enable HTTP tracing for registry interactions
   --snapshotter value     snapshotter name. Empty value stands for the default value. [$CONTAINERD_SNAPSHOTTER]
   --label value           labels to attach to the image
   --rw                    Enable write support on the mount
   --platform value        Mount the image for the specified platform (default: "linux/amd64")

挂载镜像到指定目录

sudo mkdir /opt/image/ingress
sudo ctr -n k8s.io images mount docker.io/nginx/nginx-ingress:3.2.1 /opt/image/ingress

卸载镜像目录

sudo ctr -n k8s.io images unmount --help
NAME:
   ctr images unmount - unmount the image from the target

USAGE:
   ctr images unmount [command options] [flags] <target>

DESCRIPTION:
   Unmount the image rootfs from the specified target.

OPTIONS:
   --skip-verify, -k       skip SSL certificate validation
   --plain-http            allow connections using plain HTTP
   --user value, -u value  user[:password] Registry user and password
   --refresh value         refresh token for authorization server
   --hosts-dir value       Custom hosts configuration directory
   --tlscacert value       path to TLS root CA
   --tlscert value         path to TLS client certificate
   --tlskey value          path to TLS client key
   --http-dump             dump all HTTP request/responses when interacting with container registry
   --http-trace            enable HTTP tracing for registry interactions
   --snapshotter value     snapshotter name. Empty value stands for the default value. [$CONTAINERD_SNAPSHOTTER]
   --label value           labels to attach to the image
   --rm                    remove the snapshot after a successful unmount

导出镜像

sudo ctr -n k8s.io images export ingress.3.2.1.tar docker.io/nginx/nginx-ingress:3.2.1

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值