github.com/olljanat/moby@v1.13.1/docs/reference/commandline/volume_ls.md (about)

     1  ---
     2  title: "volume ls"
     3  description: "The volume ls command description and usage"
     4  keywords: "volume, list"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # volume ls
    17  
    18  ```markdown
    19  Usage:  docker volume ls [OPTIONS]
    20  
    21  List volumes
    22  
    23  Aliases:
    24    ls, list
    25  
    26  Options:
    27    -f, --filter value   Provide filter values (e.g. 'dangling=true') (default [])
    28                         - dangling=<boolean> a volume if referenced or not
    29                         - driver=<string> a volume's driver name
    30                         - label=<key> or label=<key>=<value>
    31                         - name=<string> a volume's name
    32        --format string  Pretty-print volumes using a Go template
    33        --help           Print usage
    34    -q, --quiet          Only display volume names
    35  ```
    36  
    37  List all the volumes Docker knows about. You can filter using the `-f` or `--filter` flag. Refer to the [filtering](#filtering) section for more information about available filter options.
    38  
    39  Example output:
    40  
    41  ```bash
    42  $ docker volume create rosemary
    43  rosemary
    44  $docker volume create tyler
    45  tyler
    46  $ docker volume ls
    47  DRIVER              VOLUME NAME
    48  local               rosemary
    49  local               tyler
    50  ```
    51  
    52  ## Filtering
    53  
    54  The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
    55  than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
    56  
    57  The currently supported filters are:
    58  
    59  * dangling (boolean - true or false, 0 or 1)
    60  * driver (a volume driver's name)
    61  * label (`label=<key>` or `label=<key>=<value>`)
    62  * name (a volume's name)
    63  
    64  ### dangling
    65  
    66  The `dangling` filter matches on all volumes not referenced by any containers
    67  
    68  ```bash
    69  $ docker run -d  -v tyler:/tmpwork  busybox
    70  
    71  f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18
    72  $ docker volume ls -f dangling=true
    73  DRIVER              VOLUME NAME
    74  local               rosemary
    75  ```
    76  
    77  ### driver
    78  
    79  The `driver` filter matches on all or part of a volume's driver name.
    80  
    81  The following filter matches all volumes with a driver name containing the `local` string.
    82  
    83  ```bash
    84  $ docker volume ls -f driver=local
    85  
    86  DRIVER              VOLUME NAME
    87  local               rosemary
    88  local               tyler
    89  ```
    90  
    91  #### Label
    92  
    93  The `label` filter matches volumes based on the presence of a `label` alone or
    94  a `label` and a value.
    95  
    96  First, let's create some volumes to illustrate this;
    97  
    98  ```bash
    99  $ docker volume create the-doctor --label is-timelord=yes
   100  the-doctor
   101  $ docker volume create daleks --label is-timelord=no
   102  daleks
   103  ```
   104  
   105  The following example filter matches volumes with the `is-timelord` label
   106  regardless of its value.
   107  
   108  ```bash
   109  $ docker volume ls --filter label=is-timelord
   110  
   111  DRIVER              VOLUME NAME
   112  local               daleks
   113  local               the-doctor
   114  ```
   115  
   116  As can be seen in the above example, both volumes with `is-timelord=yes`, and
   117  `is-timelord=no` are returned.
   118  
   119  Filtering on both `key` *and* `value` of the label, produces the expected result:
   120  
   121  ```bash
   122  $ docker volume ls --filter label=is-timelord=yes
   123  
   124  DRIVER              VOLUME NAME
   125  local               the-doctor
   126  ```
   127  
   128  Specifying multiple label filter produces an "and" search; all conditions
   129  should be met;
   130  
   131  ```bash
   132  $ docker volume ls --filter label=is-timelord=yes --filter label=is-timelord=no
   133  
   134  DRIVER              VOLUME NAME
   135  ```
   136  
   137  ### name
   138  
   139  The `name` filter matches on all or part of a volume's name.
   140  
   141  The following filter matches all volumes with a name containing the `rose` string.
   142  
   143      $ docker volume ls -f name=rose
   144      DRIVER              VOLUME NAME
   145      local               rosemary
   146  
   147  ## Formatting
   148  
   149  The formatting options (`--format`) pretty-prints volumes output
   150  using a Go template.
   151  
   152  Valid placeholders for the Go template are listed below:
   153  
   154  Placeholder   | Description
   155  --------------|------------------------------------------------------------------------------------------
   156  `.Name`       | Network name
   157  `.Driver`     | Network driver
   158  `.Scope`      | Network scope (local, global)
   159  `.Mountpoint` | Whether the network is internal or not.
   160  `.Labels`     | All labels assigned to the volume.
   161  `.Label`      | Value of a specific label for this volume. For example `{{.Label "project.version"}}`
   162  
   163  When using the `--format` option, the `volume ls` command will either
   164  output the data exactly as the template declares or, when using the
   165  `table` directive, includes column headers as well.
   166  
   167  The following example uses a template without headers and outputs the
   168  `Name` and `Driver` entries separated by a colon for all volumes:
   169  
   170  ```bash
   171  $ docker volume ls --format "{{.Name}}: {{.Driver}}"
   172  vol1: local
   173  vol2: local
   174  vol3: local
   175  ```
   176  
   177  ## Related information
   178  
   179  * [volume create](volume_create.md)
   180  * [volume inspect](volume_inspect.md)
   181  * [volume rm](volume_rm.md)
   182  * [volume prune](volume_prune.md)
   183  * [Understand Data Volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)