
Containerd
ctr
ctr --help
[root@devops sonarqube_docker]# ctr --help
NAME:
ctr -
__
_____/ /______
/ ___/ __/ ___/
/ /__/ /_/ /
\___/\__/_/
containerd CLI
USAGE:
ctr [global options] command [command options] [arguments...]
VERSION:
v1.7.24
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.
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 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
任务task
ctr task --help
[root@devops sonarqube_docker]# ctr task --help
NAME:
ctr tasks - Manage tasks
USAGE:
ctr tasks command [command options] [arguments...]
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
查看指定命名空间下任务
[root@devops sonarqube_docker]# ctr -n moby task ls
TASK PID STATUS
bf1f67615b1d69ec42979b463dbc5423b16630186a15ce001d6245413309af7b 3013 RUNNING
5f227faa72b65e8c80ec4bf7b0eb685a2cc69738678cdfddae637c72f10aaba3 4507 RUNNING
删除指定命名空间下的任务
[root@devops sonarqube_docker]# ctr -n moby task kill 5f227faa72b65e8c80ec4bf7b0eb685a2cc69738678cdfddae637c72f10aaba3
命名空间namespace/ns
ctr ns --help
[root@devops sonarqube_docker]# ctr ns --help
NAME:
ctr namespaces - Manage namespaces
USAGE:
ctr namespaces command [command options] [arguments...]
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
查看命名空间
[root@devops sonarqube_docker]# ctr ns ls
NAME LABELS
default
kubewbw
moby
删除命名空间
[root@devops sonarqube_docker]# ctr ns rm moby
moby
内容content
ctr content --help
[root@devops sonarqube_docker]# ctr content --help
NAME:
ctr content - Manage content
USAGE:
ctr content command [command options] [arguments...]
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
查看内容
[root@devops sonarqube_docker]# ctr -n moby content ls
DIGEST SIZE AGE LABELS
sha256:1ad0e4b39f4ee4e9e2ab2107d98eb4dc534f805c27d2f7dc74dc81bf80b13cde 1.373kB 51 minutes containerd.io/distribution.source.docker.io=library/sonarqube
删除内容
[root@devops sonarqube_docker]# ctr -n moby content del sha256:7bf15a21a948d5f3336d8c1d5e9ceb3d576fdf95cb7afd7a9c8461f7dfcefeb2
sha256:7bf15a21a948d5f3336d8c1d5e9ceb3d576fdf95cb7afd7a9c8461f7dfcefeb2
镜像image
ctr image --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 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@devops sonarqube_docker]# ctr -n kubewbw image ls
REF TYPE DIGEST SIZE PLATFORMS LABELS
docker.io/library/nginx:latest application/vnd.oci.image.index.v1+json sha256:fb197595ebe76b9c0c14ab68159fd3c08bd067ec62300583543f0ebda353b5be 10.0 KiB - -
删除镜像
[root@devops sonarqube_docker]# ctr -n kubewbw image del docker.io/library/nginx:latest
docker.io/library/nginx:latest
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 程序员小王
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果