Podman stop --filter flag

Filter flag is added for podman stop and podman --remote stop. Filtering logic is implemented in
getContainersAndInputByContext(). Start filtering can be manipulated to use this logic as well to limit redundancy.

Signed-off-by: Karthik Elango <kelango@redhat.com>
This commit is contained in:
Karthik Elango
2022-06-28 15:31:20 -04:00
committed by Matthew Heon
parent a78be890ee
commit 6d84a9952f
9 changed files with 125 additions and 19 deletions

View File

@ -25,6 +25,30 @@ Stop all running containers. This does not include paused containers.
Read container ID from the specified file and remove the container. Can be specified multiple times.
#### **--filter**, **-f**=*filter*
Filter what containers are going to be stopped.
Multiple filters can be given with multiple uses of the --filter flag.
Filters with the same key work inclusive with the only exception being
`label` which is exclusive. Filters with different keys always work exclusive.
Valid filters are listed below:
| **Filter** | **Description** |
| --------------- | -------------------------------------------------------------------------------- |
| id | [ID] Container's ID (accepts regex) |
| name | [Name] Container's name (accepts regex) |
| label | [Key] or [Key=Value] Label assigned to a container |
| exited | [Int] Container's exit code |
| status | [Status] Container's status: 'created', 'exited', 'paused', 'running', 'unknown' |
| ancestor | [ImageName] Image or descendant used to create container |
| before | [ID] or [Name] Containers created before this container |
| since | [ID] or [Name] Containers created since this container |
| volume | [VolumeName] or [MountpointDestination] Volume mounted in container |
| health | [Status] healthy or unhealthy |
| pod | [Pod] name or full or partial ID of pod |
| network | [Network] name or full ID of network |
#### **--ignore**, **-i**
Ignore errors when specified containers are not in the container store. A user