github.com/dims/containerd@v0.2.5/docs/cli.md (about) 1 # Client CLI 2 3 There is a default cli named `ctr` based on the GRPC api. 4 This cli will allow you to create and manage containers run with containerd. 5 6 ``` 7 $ ctr -h 8 NAME: 9 ctr - High performance container daemon cli 10 11 USAGE: 12 ctr [global options] command [command options] [arguments...] 13 14 VERSION: 15 0.1.0 commit: 54c213e8a719d734001beb2cb8f130c84cc3bd20 16 17 COMMANDS: 18 checkpoints list all checkpoints 19 containers interact with running containers 20 events receive events from the containerd daemon 21 state get a raw dump of the containerd state 22 help, h Shows a list of commands or help for one command 23 24 GLOBAL OPTIONS: 25 --debug enable debug output in the logs 26 --address "/run/containerd/containerd.sock" address of GRPC API 27 --help, -h show help 28 --version, -v print the version 29 ``` 30 31 ## Starting a container 32 33 ``` 34 $ ctr containers start -h 35 NAME: 36 ctr containers start - start a container 37 38 USAGE: 39 ctr containers start [command options] [arguments...] 40 41 OPTIONS: 42 --checkpoint, -c checkpoint to start the container from 43 --attach, -a connect to the stdio of the container 44 --label, -l [--label option --label option] set labels for the container 45 ``` 46 47 ```bash 48 $ sudo ctr containers start redis /containers/redis 49 ``` 50 51 `/containers/redis` is the path to an OCI bundle. [See the bundle docs for more information.](bundle.md) 52 53 ## Listing containers 54 55 ```bash 56 $ sudo ctr containers 57 ID PATH STATUS PROCESSES 58 1 /containers/redis running 14063 59 19 /containers/redis running 14100 60 14 /containers/redis running 14117 61 4 /containers/redis running 14030 62 16 /containers/redis running 14061 63 3 /containers/redis running 14024 64 12 /containers/redis running 14097 65 10 /containers/redis running 14131 66 18 /containers/redis running 13977 67 13 /containers/redis running 13979 68 15 /containers/redis running 13998 69 5 /containers/redis running 14021 70 9 /containers/redis running 14075 71 6 /containers/redis running 14107 72 2 /containers/redis running 14135 73 11 /containers/redis running 13978 74 17 /containers/redis running 13989 75 8 /containers/redis running 14053 76 7 /containers/redis running 14022 77 0 /containers/redis running 14006 78 ``` 79 80 ## Kill a container's process 81 82 ``` 83 $ ctr containers kill -h 84 NAME: 85 ctr containers kill - send a signal to a container or its processes 86 87 USAGE: 88 ctr containers kill [command options] [arguments...] 89 90 OPTIONS: 91 --pid, -p "init" pid of the process to signal within the container 92 --signal, -s "15" signal to send to the container 93 ``` 94 95 ## Exec another process into a container 96 97 ``` 98 $ ctr containers exec -h 99 NAME: 100 ctr containers exec - exec another process in an existing container 101 102 USAGE: 103 ctr containers exec [command options] [arguments...] 104 105 OPTIONS: 106 --id container id to add the process to 107 --pid process id for the new process 108 --attach, -a connect to the stdio of the container 109 --cwd current working directory for the process 110 --tty, -t create a terminal for the process 111 --env, -e [--env option --env option] environment variables for the process 112 --uid, -u "0" user id of the user for the process 113 --gid, -g "0" group id of the user for the process 114 ``` 115 116 ## Stats for a container 117 118 ``` 119 $ ctr containers stats -h 120 NAME: 121 ctr containers stats - get stats for running container 122 123 USAGE: 124 ctr containers stats [arguments...] 125 ``` 126 127 ## List checkpoints 128 129 ``` 130 $ sudo ctr checkpoints redis 131 NAME TCP UNIX SOCKETS SHELL 132 test false false false 133 test2 false false false 134 ``` 135 136 ## Create a new checkpoint 137 138 ``` 139 $ ctr checkpoints create -h 140 NAME: 141 ctr checkpoints create - create a new checkpoint for the container 142 143 USAGE: 144 ctr checkpoints create [command options] [arguments...] 145 146 OPTIONS: 147 --tcp persist open tcp connections 148 --unix-sockets perist unix sockets 149 --exit exit the container after the checkpoint completes successfully 150 --shell checkpoint shell jobs 151 ``` 152 153 ## Get events 154 155 ``` 156 $ sudo ctr events 157 TYPE ID PID STATUS 158 exit redis 24761 0 159 ```