Update filter.md

* Clarify the description in the "Combining filters" section to accurately reflect the behavior of the provided example
* Fix grammar errors
This commit is contained in:
Yuki Sasaki 2023-11-18 11:12:28 +09:00 committed by GitHub
parent 2da43407ac
commit 5834669a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -39,7 +39,7 @@ alpine 3.16 a8cbb8c69ee7 40 minutes ago 8.67MB
alpine latest 7144f7bab3d4 40 minutes ago 11.7MB alpine latest 7144f7bab3d4 40 minutes ago 11.7MB
``` ```
The available fields (`reference` in this case) depends on the command you run. The available fields (`reference` in this case) depend on the command you run.
Some filters expect an exact match. Others handle partial matches. Some filters Some filters expect an exact match. Others handle partial matches. Some filters
let you use regular expressions. let you use regular expressions.
@ -49,8 +49,8 @@ about the supported filtering capabilities for each command.
## Combining filters ## Combining filters
You can combine multiple filters by passing multiple `--filter` flags. The You can combine multiple filters by passing multiple `--filter` flags. The
following example shows how to print all images that don't match following example shows how to print all images that match `alpine:latest` or
`alpine:latest` or `busybox` - a logical `OR`. `busybox` - a logical `OR`.
```console ```console
$ docker images $ docker images
@ -71,17 +71,17 @@ busybox glibc 7338d0c72c65 2 hours ago 6.09MB
### Multiple negated filters ### Multiple negated filters
Some commands support negated filters on [labels](./labels-custom-metadata.md). Some commands support negated filters on [labels](./labels-custom-metadata.md).
Negated filters only consider results don't match the specified patterns. The Negated filters only consider results that don't match the specified patterns.
following command prunes all containers that aren't labeled `foo`. The following command prunes all containers that aren't labeled `foo`.
```console ```console
$ docker container prune --filter "label!=foo" $ docker container prune --filter "label!=foo"
``` ```
There's a catch in combining multiple negated label filters. Multiple negated There's a catch in combining multiple negated label filters. Multiple negated
filters a single negative constraint - a logical `AND`. The following command filters create a single negative constraint - a logical `AND`. The following
prunes all containers except those labeled both `foo` and `bar`. Containers command prunes all containers except those labeled both `foo` and `bar`.
labeled either `foo` or `bar`, but not both, will be pruned. Containers labeled either `foo` or `bar`, but not both, will be pruned.
```console ```console
$ docker container prune --filter "label!=foo" --filter "label!=bar" $ docker container prune --filter "label!=foo" --filter "label!=bar"