containerd命令--ctr和crictl
ctr
ctr是containerd的cli工具
[root@master ~]# ctr --help
NAME:
ctr - containerd CLI
USAGE:
ctr [global options] command [command options] [arguments...]
VERSION:
v1.6.19
DESCRIPTION:
ctr is an unsupported debug and administrative client for interacting with the containerd daemon. Because it is unsupported, the commands,options, and operations are not guaranteed to be backward compatible or stable from release to release of the containerd project.
ctr是一个不受支持的调试和管理客户端,用于与containerd守护进程交互。由于不支持它,因此无法保证命令、选项和操作在containerd项目的各个版本之间向后兼容或稳定。
COMMANDS:
plugins, plugin 提供了有关containerd插件的信息 provides information about containerd plugins
version 打印客户端和服务器版本 print the client and server versions
containers, c, container 管理容器 manage containers
content 管理内容 manage content
events, event 显示容器事件 display containerd events
images, image, i 管理镜像 manage images
leases 管理租赁 manage leases
namespaces, namespace, ns 管理命名空间 manage namespaces
pprof 为containerd提供golang-prof输出 provide golang pprof outputs for containerd
run 运行容器 run a container
snapshots, snapshot 管理快照 manage snapshots
tasks, t, task 管理任务 manage tasks
install 安装新程序包 install a new package
oci OCI工具 OCI tools
shim 直接与垫片相互作用 interact with a shim directly
help, h 显示命令列表或一个命令的帮助 Shows a list of commands or help for one command
GLOBAL OPTIONS:
--debug enable debug output in logs
--address value, -a value address for containerd's GRPC server (default: "/run/containerd/containerd.sock") [$CONTAINERD_ADDRESS]
--timeout value total timeout for ctr commands (default: 0s)
--connect-timeout value timeout for connecting to containerd (default: 0s)
--namespace value, -n value namespace to use with commands (default: "default") [$CONTAINERD_NAMESPACE]
--help, -h show help
--version, -v print the version
ctr image
[root@master ~]# ctr i --help
NAME:
ctr images - manage images
USAGE:
ctr images command [command options] [arguments...]
COMMANDS:
check 检查现有镜像以确保所有内容在本地可用 check existing images to ensure all content is available locally
export 导出镜像 export images
import 导入镜像 import images
list, ls 列出container已知的镜像 list images known to containerd
mount 将镜像装载到目标路径 mount an image to a target path
unmount 从目标卸载映像 unmount the image from the target
pull 从遥控器中提取镜像 pull an image from a remote
push 将镜像推送到遥控器 push an image to a remote
delete, del, remove, rm 通过引用删除一个或多个镜像 remove one or more images by reference
tag 标记镜像 tag an image
label 设置并清除镜像的标签 set and clear labels for an image
convert 转换镜像 convert an image
OPTIONS:
--help, -h show help
ctr container
[root@master ~]# ctr c --help
NAME:
ctr containers - manage containers
USAGE:
ctr containers command [command options] [arguments...]
COMMANDS:
create 创建容器 create container
delete, del, remove, rm 删除一个或多个现有容器 delete one or more existing containers
info 获取有关容器的信息 get info about a container
list, ls 列出容器 list containers
label 设置并清除容器的标签 set and clear labels for a container
checkpoint checkpoint一个容器 checkpoint a container
restore 从检查点恢复容器 restore a container from checkpoint
OPTIONS:
--help, -h show help
crictl
crictl是k8s集群CRI的client工具
[root@master ~]# crictl --help
NAME:
crictl - client for CRI
USAGE:
crictl [global options] command [command options] [arguments...]
VERSION:
1.24.1
COMMANDS:
attach 连接到正在运行的容器 Attach to a running container
create 创建新容器 Create a new container
exec 在运行容器中运行命令 Run a command in a running container
version 显示运行时版本信息 Display runtime version information
images, image, img 列出镜像 List images
inspect 显示一个或多个容器的状态 Display the status of one or more containers
inspecti 返回一个或多个镜像的状态 Return the status of one or more images
imagefsinfo 返回镜像文件系统信息 Return image filesystem info
inspectp 显示一个或多个pod的状态 Display the status of one or more pods
logs 获取容器的日志 Fetch the logs of a container
port-forward 将本地端口转发到pod Forward local port to a pod
ps 列出容器 List containers
pull 从仓库中提取镜像 Pull an image from a registry
run 在沙盒中运行新容器 Run a new container inside a sandbox
runp 运行新pod Run a new pod
rm 移除一个或多个容器 Remove one or more containers
rmi 删除一个或多个镜像 Remove one or more images
rmp 移除一个或多个pod Remove one or more pods
pods 列出pod List pods
start 启动一个或多个创建的容器 Start one or more created containers
info 显示容器运行时的信息 Display information of the container runtime
stop 停止一个或多个正在运行的容器 Stop one or more running containers
stopp 停止一个或多个跑步pod Stop one or more running pods
update 更新一个或多个正在运行的容器 Update one or more running containers
config 获取并设置crictl客户端配置选项 Get and set crictl client configuration options
stats 列出容器资源使用情况统计信息 List container(s) resource usage statistics
statsp 列出pod资源使用情况统计信息 List pod resource usage statistics
completion 输出shell完成代码 Output shell completion code
help, h 显示命令列表或一个命令的帮助 Shows a list of commands or help for one command
GLOBAL OPTIONS:
--config value, -c value Location of the client config file. If not specified and the default does not exist, the program's directory is searched as well (default: "/etc/crictl.yaml") [$CRI_CONFIG_FILE]
--debug, -D Enable debug mode (default: false)
--image-endpoint value, -i value Endpoint of CRI image manager service (default: uses 'runtime-endpoint' setting) [$IMAGE_SERVICE_ENDPOINT]
--runtime-endpoint value, -r value Endpoint of CRI container runtime service (default: uses in order the first successful one of [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]). Default is now deprecated and the endpoint should be set instead. [$CONTAINER_RUNTIME_ENDPOINT]
--timeout value, -t value Timeout of connecting to the server in seconds (e.g. 2s, 20s.). 0 or less is set to default (default: 2s)
--help, -h show help (default: false)
--version, -v print the version (default: false)