docker volume ls (original) (raw)
Description | List volumes |
---|---|
Usage | docker volume ls [OPTIONS] |
AliasesAn alias is a short or memorable alternative for a longer command. | docker volume list |
List all the volumes known to Docker. You can filter using the -f
or--filter
flag. Refer to thefiltering section for more information about available filter options.
Option | Default | Description |
---|---|---|
--cluster | API 1.42+ SwarmDisplay only cluster volumes, and use cluster volume list formatting | |
-f, --filter | Provide filter values (e.g. dangling=true) | |
--format | Format output using a custom template:'table': Print output in table format with column headers (default)'table TEMPLATE': Print output in table format using the given Go template'json': Print in JSON format'TEMPLATE': Print output using the given Go template.Refer tohttps://docs.docker.com/go/formatting/ for more information about formatting output with templates | |
-q, --quiet | Only display volume names |
Create a volume
Filtering (--filter)
The filtering flag (-f
or --filter
) format is of "key=value". If there is more than one filter, then pass multiple flags (e.g., --filter "foo=bar" --filter "bif=baz"
)
The currently supported filters are:
- dangling (Boolean - true or false, 0 or 1)
- driver (a volume driver's name)
- label (
label=<key>
orlabel=<key>=<value>
) - name (a volume's name)
dangling
The dangling
filter matches on all volumes not referenced by any containers
driver
The driver
filter matches volumes based on their driver.
The following example matches volumes that are created with the local
driver:
label
The label
filter matches volumes based on the presence of a label
alone or a label
and a value.
First, create some volumes to illustrate this;
The following example filter matches volumes with the is-timelord
label regardless of its value.
As the above example demonstrates, both volumes with is-timelord=yes
, andis-timelord=no
are returned.
Filtering on both key
and value
of the label, produces the expected result:
Specifying multiple label filter produces an "and" search; all conditions should be met;
name
The name
filter matches on all or part of a volume's name.
The following filter matches all volumes with a name containing the rose
string.
Format the output (--format)
The formatting options (--format
) pretty-prints volumes output using a Go template.
Valid placeholders for the Go template are listed below:
Placeholder | Description |
---|---|
.Name | Volume name |
.Driver | Volume driver |
.Scope | Volume scope (local, global) |
.Mountpoint | The mount point of the volume on the host |
.Labels | All labels assigned to the volume |
.Label | Value of a specific label for this volume. For example {{.Label "project.version"}} |
When using the --format
option, the volume ls
command will either output the data exactly as the template declares or, when using thetable
directive, includes column headers as well.
The following example uses a template without headers and outputs theName
and Driver
entries separated by a colon (:
) for all volumes:
To list all volumes in JSON format, use the json
directive: