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