{{tag>[containerd]}} ====== ctr ====== containerd의 CLI ===== USAGE ===== * ''**ctr** [global options] command [command options] [arguments]'' * ''global options'' * ''**--address**'', ''**-a**'' container sockert (default: ''/urn/containerd/containrd.sock'') * ''**--namespace** namespace'', ''**-n** namespace'' namespace(default: ''default'') * ''**--debug**'' ==== namespace ==== > k8s는 ''k8s.io''네임스페이스, docker는 ''moby'' * ''**ctr** **namespace ls**'' 네임스페이스 목록 * ''**ctr** **namespace create** name'' * ''**ctr** **namespace rm** name'' ==== images ==== * ''**ctr** **image pull** image'' 이미지 pull * ''**--platform** linux/amd64'' * ''**ctr** **image ls**'' 이미지 목록 * ''**ctr** **image rm** image'' 이미지 삭제 * ''**ctr** **image tag** src dst'' 태그 * ''**ctr** **image export** file.tar image'' 내보내기 * ''**ctr** **image import** file.tar'' 가져오기 * ''**ctr** **image check**'' 이미지 레이어 무결성 확인 * ''**ctr** **image mount** image mountpoint'' 이미지 마운트 * ''**ctr** **image unmount** mountpoint'' ==== container ==== ctr container create \ --env KEY=VALUE \ --mount type=bind,src=/host,dst=/container,options=rbind:rw \ --net-host \ * ''**ctr** **container create** image id'' 컨테이너 생성 * ''**ctr** **container ls**'' 목록 * ''**ctr** **container info** id'' 상세정보 JSON * ''**ctr** **container rm** id'' 삭제 ==== task ==== > 실제 프로세스 실행단위 * ''**ctr** **task start** id'' task 시작 * ''**--detach**'', ''**-d**'' * ''**ctr** **task ls**'' 실행중인 task 목록 * ''**ctr** **task exec** eid id cmd'' 실행 ++ tty || \\ ''**ctr** **task exec** sh1 **-t** id sh'' tty attach ++ * ''**ctr** **task attach** id'' stdout/stderr attach * ''**ctr** **task pause** id'' * ''**ctr** **task resume** id'' * ''**ctr** **task kill** id'' * ''**--signal** SIGKILL'' * ''**ctr** **task rm** id'' task 제거(stop) * ''**ctr** **task ps** id'' task 내 프로세스 목록 ==== run ==== ctr run -d \ --env KEY=VAL \ --mount type=bind,src=/data,dst=/data,options=rbind:rw \ > create + start * ''**ctr** **run** image id'' forground * ''**--detach**'', ''**-d**'' * ''**--net-host**'' * ''**--rm**'' 실행 후 작동 삭제 ==== snapshot ==== > 레이어 관리 * ''**ctr** **snapshot ls**'' forground * ''**ctr** **snpashot info** key'' forground * ''**ctr** **snapshot rm** key'' forground * ''**ctr** **snapshot tree**'' forground ==== content ==== > blob 관리 * ''**ctr** **content ls**'' forground * ''**ctr** **content get** digest'' * ''**ctr** **content delete** digest'' ==== lease === * ''**ctr** **leases ls**'' * ''**ctr** **leases create** **--id** id'' * ''**ctr** **leases delete** id'' ==== plugin ==== * ''**ctr** **plugin ls**'' 로드된 플러그인 목록 ==== HELP ==== ++++ ctr --help | NAME: ctr - __ _____/ /______ / ___/ __/ ___/ / /__/ /_/ / \___/\__/_/ containerd CLI USAGE: ctr [global options] command [command options] VERSION: 2.2.0 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 (default: false) --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 (default: false) --version, -v Print the version (default: false) ++++