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.
COMMANDS: plugins, plugin 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 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 tools sandboxes, sandbox, sb, s Manage sandboxes info Print the server info deprecations shim Interact with a shim directly help, h Shows a list of commands or helpfor 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
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 a container restore Restore a container from checkpoint
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 a container restore Restore a container from checkpoint
COMMANDS: active Display active transfers delete, del, remove, rm Permanently delete one or more blobs edit Edit a blob and return a new digest fetch Fetch all content for an image into containerd fetch-object Retrieve objects from a remote fetch-blob Retrieve blobs from a remote get Get the data for an object ingest Accept content into the store list, ls List all blobs in the store push-object Push an object to a remote label Add labels to content prune Prunes content from the content store
OPTIONS: --help, -h show help
[root@ubuntu-22 open-source]#
diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@ubuntu-22 open-source]# ctr snapshots diff -h NAME: ctr snapshots diff - Get the diff of two snapshots. the default second snapshot is the first snapshot's parent.
OPTIONS: --media-type value Media type to use for creating diff (default: "application/vnd.oci.image.layer.v1.tar+gzip") --ref value Content upload reference to use --keep Keep diff content. up to creator to delete it. --label value Labels to attach to the image [root@ubuntu-22 open-source]# [root@ubuntu-22 open-source]#
COMMANDS: check Check existing images to ensure all content is available locally export Export images import Import images list, ls 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 prune Remove unused images 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 usage Display usage of snapshots for a given image ref
[root@ubuntu-22 ~]# ctr plugin ls TYPE ID PLATFORMS STATUS io.containerd.snapshotter.v1 aufs linux/amd64 skip io.containerd.event.v1 exchange - ok io.containerd.internal.v1 opt - ok io.containerd.warning.v1 deprecations - ok io.containerd.snapshotter.v1 blockfile linux/amd64 skip io.containerd.snapshotter.v1 btrfs linux/amd64 skip io.containerd.snapshotter.v1 devmapper linux/amd64 error io.containerd.snapshotter.v1 native linux/amd64 ok io.containerd.snapshotter.v1 overlayfs linux/amd64 ok io.containerd.snapshotter.v1 zfs linux/amd64 skip io.containerd.content.v1 content - ok io.containerd.metadata.v1 bolt - ok io.containerd.gc.v1 scheduler - ok io.containerd.differ.v1 walking linux/amd64 ok io.containerd.lease.v1 manager - ok io.containerd.streaming.v1 manager - ok io.containerd.runtime.v1 linux linux/amd64 ok io.containerd.monitor.v1 cgroups linux/amd64 ok io.containerd.runtime.v2 task linux/amd64 ok io.containerd.runtime.v2 shim - ok io.containerd.sandbox.store.v1 local - ok io.containerd.sandbox.controller.v1 local - ok io.containerd.service.v1 containers-service - ok io.containerd.service.v1 content-service - ok io.containerd.service.v1 diff-service - ok io.containerd.service.v1 images-service - ok io.containerd.service.v1 introspection-service - ok io.containerd.service.v1 namespaces-service - ok io.containerd.service.v1 snapshots-service - ok io.containerd.service.v1 tasks-service - ok io.containerd.grpc.v1 containers - ok io.containerd.grpc.v1 content - ok io.containerd.grpc.v1 diff - ok io.containerd.grpc.v1 events - ok io.containerd.grpc.v1 images - ok io.containerd.grpc.v1 introspection - ok io.containerd.grpc.v1 leases - ok io.containerd.grpc.v1 namespaces - ok io.containerd.grpc.v1 sandbox-controllers - ok io.containerd.grpc.v1 sandboxes - ok io.containerd.grpc.v1 snapshots - ok io.containerd.grpc.v1 streaming - ok io.containerd.grpc.v1 tasks - ok io.containerd.transfer.v1 local - ok io.containerd.grpc.v1 transfer - ok io.containerd.grpc.v1 version - ok io.containerd.internal.v1 restart - ok io.containerd.tracing.processor.v1 otlp - skip io.containerd.internal.v1 tracing - skip io.containerd.grpc.v1 healthcheck - ok io.containerd.nri.v1 nri - ok io.containerd.grpc.v1 cri linux/amd64 ok [root@ubuntu-22 ~]#
COMMANDS: create, c Create a new namespace list, ls List namespaces remove, rm Remove one or more namespaces label Set and clear labels for a namespace
COMMANDS: create, c Create a new namespace list, ls List namespaces remove, rm Remove one or more namespaces label Set and clear labels for a namespace
COMMANDS: commit Commit an active snapshot into the provided name diff Get the diff of two snapshots. the default second snapshot is the first snapshot's parent. info Get info about a snapshot list, ls List snapshots mounts, m, mount Mount gets mount commands for the snapshots prepare Prepare a snapshot from a committed snapshot delete, del, remove, rm Remove snapshots label Add labels to content tree Display tree view of snapshot branches unpack Unpack applies layers from a manifest to a snapshot usage Usage snapshots view Create a read-only snapshot from a committed snapshot
OPTIONS: --snapshotter value Snapshotter name. Empty value stands for the default value. [$CONTAINERD_SNAPSHOTTER] --help, -h show help
COMMANDS: attach Attach to the IO of a running container checkpoint Checkpoint a container delete, del, remove, rm Delete one or more tasks exec Execute additional processes in an existing container list, ls List tasks kill Signal a container (default: SIGTERM) metrics, metric Get a single data point of metrics for a task with the built-in Linux runtime pause Pause an existing container ps List processes for container resume Resume a paused container start Start a container that has been created
COMMANDS: attach Attach to the IO of a running container checkpoint Checkpoint a container delete, del, remove, rm Delete one or more tasks exec Execute additional processes in an existing container list, ls List tasks kill Signal a container (default: SIGTERM) metrics, metric Get a single data point of metrics for a task with the built-in Linux runtime pause Pause an existing container ps List processes for container resume Resume a paused container start Start a container that has been created
OPTIONS: --help, -h show help
tranfer & streaming
演进中、
version
返回containerd的版本号
1 2 3 4 5 6 7 8 9 10
[root@ubuntu-22 ~]# ctr version Client: Version: v1.7.18 Revision: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e Go version: go1.21.11
[root@ubuntu-22 ~]# ctr plugin ls TYPE ID PLATFORMS STATUS io.containerd.snapshotter.v1 aufs linux/amd64 skip io.containerd.event.v1 exchange - ok io.containerd.internal.v1 opt - ok io.containerd.warning.v1 deprecations - ok io.containerd.snapshotter.v1 blockfile linux/amd64 skip io.containerd.snapshotter.v1 btrfs linux/amd64 skip io.containerd.snapshotter.v1 devmapper linux/amd64 error io.containerd.snapshotter.v1 native linux/amd64 ok io.containerd.snapshotter.v1 overlayfs linux/amd64 ok io.containerd.snapshotter.v1 zfs linux/amd64 skip io.containerd.content.v1 content - ok io.containerd.metadata.v1 bolt - ok io.containerd.gc.v1 scheduler - ok io.containerd.differ.v1 walking linux/amd64 ok io.containerd.lease.v1 manager - ok io.containerd.streaming.v1 manager - ok io.containerd.runtime.v1 linux linux/amd64 ok io.containerd.monitor.v1 cgroups linux/amd64 ok io.containerd.runtime.v2 task linux/amd64 ok io.containerd.runtime.v2 shim - ok io.containerd.sandbox.store.v1 local - ok io.containerd.sandbox.controller.v1 local - ok io.containerd.service.v1 containers-service - ok io.containerd.service.v1 content-service - ok io.containerd.service.v1 diff-service - ok io.containerd.service.v1 images-service - ok io.containerd.service.v1 introspection-service - ok io.containerd.service.v1 namespaces-service - ok io.containerd.service.v1 snapshots-service - ok io.containerd.service.v1 tasks-service - ok io.containerd.grpc.v1 containers - ok io.containerd.grpc.v1 content - ok io.containerd.grpc.v1 diff - ok io.containerd.grpc.v1 events - ok io.containerd.grpc.v1 images - ok io.containerd.grpc.v1 introspection - ok io.containerd.grpc.v1 leases - ok io.containerd.grpc.v1 namespaces - ok io.containerd.grpc.v1 sandbox-controllers - ok io.containerd.grpc.v1 sandboxes - ok io.containerd.grpc.v1 snapshots - ok io.containerd.grpc.v1 streaming - ok io.containerd.grpc.v1 tasks - ok io.containerd.transfer.v1 local - ok io.containerd.grpc.v1 transfer - ok io.containerd.grpc.v1 version - ok io.containerd.internal.v1 restart - ok io.containerd.tracing.processor.v1 otlp - skip io.containerd.internal.v1 tracing - skip io.containerd.grpc.v1 healthcheck - ok io.containerd.nri.v1 nri - ok io.containerd.grpc.v1 cri linux/amd64 ok [root@ubuntu-22 ~]#
[root@ubuntu-22 ~]# ctr plugin ls |grep io.containerd.service.v1 io.containerd.service.v1 containers-service - ok io.containerd.service.v1 content-service - ok io.containerd.service.v1 diff-service - ok io.containerd.service.v1 images-service - ok io.containerd.service.v1 introspection-service - ok io.containerd.service.v1 namespaces-service - ok io.containerd.service.v1 snapshots-service - ok io.containerd.service.v1 tasks-service - ok [root@ubuntu-22 ~]# [root@ubuntu-22 ~]# [root@ubuntu-22 ~]# ctr plugin ls |grep io.containerd.grpc.v1 io.containerd.grpc.v1 containers - ok io.containerd.grpc.v1 content - ok io.containerd.grpc.v1 diff - ok io.containerd.grpc.v1 events - ok io.containerd.grpc.v1 images - ok io.containerd.grpc.v1 introspection - ok io.containerd.grpc.v1 leases - ok io.containerd.grpc.v1 namespaces - ok io.containerd.grpc.v1 sandbox-controllers - ok io.containerd.grpc.v1 sandboxes - ok io.containerd.grpc.v1 snapshots - ok io.containerd.grpc.v1 streaming - ok io.containerd.grpc.v1 tasks - ok io.containerd.grpc.v1 transfer - ok io.containerd.grpc.v1 version - ok io.containerd.grpc.v1 healthcheck - ok io.containerd.grpc.v1 cri linux/amd64 ok