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