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