Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crictl exec: allow running single command in multiple containers
This patch adds the following filter flags to `crictl exec`: ``` --image value Exec command for all containers matching this container image filter --label value [ --label value ] Exec command for all containers matching this key=value label filter --last value, -n value Exec command for all last n containers, set to 0 for unlimited (default: 0) --latest, -l Exec command for the most recently created container (default: false) --name value Exec command for all containers matching this name filter regular expression pattern --pod value, -p value Exec command for all containers matching this pod ID filter --state value Exec command for all containers matching this container state filter ``` If none of the above filters are set, then crictl will assume that the first provided argument is the container ID. If one of them is set, then crictl will filter and execute for all containers: ``` > sudo ./build/bin/linux/amd64/crictl exec --name pod ps aux 8f92b841d898828833d7dc55245e5df91c517cb0fce8a61f5def7cb9e432530c: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2472 1344 ? Ss 07:09 0:00 /bin/sleep 6000 6000 root 67 0.0 0.0 5536 2700 ? Rs 07:38 0:00 ps aux 39f78a7b1835b8363a519424031ddbb370b743afad46cc401eeb73717c84e57d: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2472 1500 ? Ss 07:08 0:00 /bin/sleep 6000 6000 root 122 0.0 0.0 5536 2732 ? Rs 07:38 0:00 ps aux ``` The container ID is printed when a filter command has been used to ensure existing backwards compatibility. Signed-off-by: Sascha Grunert <[email protected]>
- Loading branch information