Add missing docs for volume ls filter=label

This filter option was added in be045ee2da7c2c83e859d86cb496e86ec6de8566,
but didn't update the documentation and
man pages.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
master
Sebastiaan van Stijn 2016-08-15 17:39:50 +02:00 committed by Tibor Vass
parent 1cddc8ee68
commit 9cec1ce2ee
1 changed files with 74 additions and 18 deletions

View File

@ -19,9 +19,10 @@ Aliases:
ls, list ls, list
Options: Options:
-f, --filter value Provide filter values (i.e. 'dangling=true') (default []) -f, --filter value Provide filter values (e.g. 'dangling=true') (default [])
- dangling=<boolean> a volume if referenced or not - dangling=<boolean> a volume if referenced or not
- driver=<string> a volume's driver name - driver=<string> a volume's driver name
- label=<key> or label=<key>=<value>
- name=<string> a volume's name - name=<string> a volume's name
--format string Pretty-print volumes using a Go template --format string Pretty-print volumes using a Go template
--help Print usage --help Print usage
@ -32,14 +33,16 @@ Lists all the volumes Docker knows about. You can filter using the `-f` or `--fi
Example output: Example output:
$ docker volume create --name rosemary ```bash
rosemary $ docker volume create --name rosemary
$docker volume create --name tyler rosemary
tyler $docker volume create --name tyler
$ docker volume ls tyler
DRIVER VOLUME NAME $ docker volume ls
local rosemary DRIVER VOLUME NAME
local tyler local rosemary
local tyler
```
## Filtering ## Filtering
@ -50,17 +53,21 @@ The currently supported filters are:
* dangling (boolean - true or false, 0 or 1) * dangling (boolean - true or false, 0 or 1)
* driver (a volume driver's name) * driver (a volume driver's name)
* label (`label=<key>` or `label=<key>=<value>`)
* name (a volume's name) * name (a volume's name)
### dangling ### dangling
The `dangling` filter matches on all volumes not referenced by any containers The `dangling` filter matches on all volumes not referenced by any containers
$ docker run -d -v tyler:/tmpwork busybox ```bash
f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18 $ docker run -d -v tyler:/tmpwork busybox
$ docker volume ls -f dangling=true
DRIVER VOLUME NAME f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18
local rosemary $ docker volume ls -f dangling=true
DRIVER VOLUME NAME
local rosemary
```
### driver ### driver
@ -68,10 +75,59 @@ The `driver` filter matches on all or part of a volume's driver name.
The following filter matches all volumes with a driver name containing the `local` string. The following filter matches all volumes with a driver name containing the `local` string.
$ docker volume ls -f driver=local ```bash
DRIVER VOLUME NAME $ docker volume ls -f driver=local
local rosemary
local tyler DRIVER VOLUME NAME
local rosemary
local tyler
```
#### Label
The `label` filter matches volumes based on the presence of a `label` alone or
a `label` and a value.
First, let's create some volumes to illustrate this;
```bash
$ docker volume create --name the-doctor --label is-timelord=yes
the-doctor
$ docker volume create --name daleks --label is-timelord=no
daleks
```
The following example filter matches volumes with the `is-timelord` label
regardless of its value.
```bash
$ docker volume ls --filter label=is-timelord
DRIVER NAME
local daleks
local the-doctor
```
As can be seen in the above example, both volumes with `is-timelord=yes`, and
`is-timelord=no` are returned.
Filtering on both `key` *and* `value` of the label, produces the expected result:
```bash
$ docker volume ls --filter label=is-timelord=yes
DRIVER NAME
local the-doctor
```
Specifying multiple label filter produces an "and" search; all conditions
should be met;
```bash
$ docker volume ls --filter label=is-timelord=yes --filter label=is-timelord=no
DRIVER NAME
```
### name ### name