diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html | |
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html new file mode 100644 index 00000000..d55482fa --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_ls%2Findex.html @@ -0,0 +1,63 @@ +<h1>docker volume ls</h1> <p><br></p> <p>List volumes</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls [OPTIONS] +</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">List all the volumes known to Docker. You can filter using the <code class="language-plaintext highlighter-rouge">-f</code> or <code class="language-plaintext highlighter-rouge">--filter</code> flag. Refer to the <a href="#filtering">filtering</a> section for more information about available filter options.</p> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td> +<code class="language-plaintext highlighter-rouge">--filter</code> , <code class="language-plaintext highlighter-rouge">-f</code> +</td> <td></td> <td>Provide filter values (e.g. 'dangling=true')</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--format</code></td> <td></td> <td>Pretty-print volumes using a Go template</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--quiet</code> , <code class="language-plaintext highlighter-rouge">-q</code> +</td> <td></td> <td>Only display volume names</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="create-a-volume">Create a volume</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create rosemary + +rosemary + +$ docker volume create tyler + +tyler + +$ docker volume ls + +DRIVER VOLUME NAME +local rosemary +local tyler +</pre></div> <h3 id="filtering">Filtering</h3> <p>The filtering flag (<code class="language-plaintext highlighter-rouge">-f</code> or <code class="language-plaintext highlighter-rouge">--filter</code>) format is of “key=value”. If there is more than one filter, then pass multiple flags (e.g., <code class="language-plaintext highlighter-rouge">--filter "foo=bar" --filter "bif=baz"</code>)</p> <p>The currently supported filters are:</p> <ul> <li>dangling (boolean - true or false, 0 or 1)</li> <li>driver (a volume driver’s name)</li> <li>label (<code class="language-plaintext highlighter-rouge">label=<key></code> or <code class="language-plaintext highlighter-rouge">label=<key>=<value></code>)</li> <li>name (a volume’s name)</li> </ul> <h4 id="dangling">dangling</h4> <p>The <code class="language-plaintext highlighter-rouge">dangling</code> filter matches on all volumes not referenced by any containers</p> <div class="highlight"><pre class="highlight" data-language="">$ docker run -d -v tyler:/tmpwork busybox + +f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18 +$ docker volume ls -f dangling=true +DRIVER VOLUME NAME +local rosemary +</pre></div> <h4 id="driver">driver</h4> <p>The <code class="language-plaintext highlighter-rouge">driver</code> filter matches volumes based on their driver.</p> <p>The following example matches volumes that are created with the <code class="language-plaintext highlighter-rouge">local</code> driver:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls -f driver=local + +DRIVER VOLUME NAME +local rosemary +local tyler +</pre></div> <h4 id="label">label</h4> <p>The <code class="language-plaintext highlighter-rouge">label</code> filter matches volumes based on the presence of a <code class="language-plaintext highlighter-rouge">label</code> alone or a <code class="language-plaintext highlighter-rouge">label</code> and a value.</p> <p>First, let’s create some volumes to illustrate this;</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create the-doctor --label is-timelord=yes + +the-doctor +$ docker volume create daleks --label is-timelord=no + +daleks +</pre></div> <p>The following example filter matches volumes with the <code class="language-plaintext highlighter-rouge">is-timelord</code> label regardless of its value.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls --filter label=is-timelord + +DRIVER VOLUME NAME +local daleks +local the-doctor +</pre></div> <p>As the above example demonstrates, both volumes with <code class="language-plaintext highlighter-rouge">is-timelord=yes</code>, and <code class="language-plaintext highlighter-rouge">is-timelord=no</code> are returned.</p> <p>Filtering on both <code class="language-plaintext highlighter-rouge">key</code> <em>and</em> <code class="language-plaintext highlighter-rouge">value</code> of the label, produces the expected result:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls --filter label=is-timelord=yes + +DRIVER VOLUME NAME +local the-doctor +</pre></div> <p>Specifying multiple label filter produces an “and” search; all conditions should be met;</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls --filter label=is-timelord=yes --filter label=is-timelord=no + +DRIVER VOLUME NAME +</pre></div> <h4 id="name">name</h4> <p>The <code class="language-plaintext highlighter-rouge">name</code> filter matches on all or part of a volume’s name.</p> <p>The following filter matches all volumes with a name containing the <code class="language-plaintext highlighter-rouge">rose</code> string.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls -f name=rose + +DRIVER VOLUME NAME +local rosemary +</pre></div> <h3 id="formatting">Formatting</h3> <p>The formatting options (<code class="language-plaintext highlighter-rouge">--format</code>) pretty-prints volumes output using a Go template.</p> <p>Valid placeholders for the Go template are listed below:</p> <table> <thead> <tr> <th>Placeholder</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Volume name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Driver</code></td> <td>Volume driver</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Scope</code></td> <td>Volume scope (local, global)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Mountpoint</code></td> <td>The mount point of the volume on the host</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Labels</code></td> <td>All labels assigned to the volume</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Label</code></td> <td>Value of a specific label for this volume. For example <code class="language-plaintext highlighter-rouge">{{.Label "project.version"}}</code> +</td> </tr> </tbody> </table> <p>When using the <code class="language-plaintext highlighter-rouge">--format</code> option, the <code class="language-plaintext highlighter-rouge">volume ls</code> command will either output the data exactly as the template declares or, when using the <code class="language-plaintext highlighter-rouge">table</code> directive, includes column headers as well.</p> <p>The following example uses a template without headers and outputs the <code class="language-plaintext highlighter-rouge">Name</code> and <code class="language-plaintext highlighter-rouge">Driver</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all volumes:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume ls --format "{{.Name}}: {{.Driver}}" + +vol1: local +vol2: local +vol3: local +</pre></div> <h2 id="parent-command">Parent command</h2> <table> <thead> <tr> <th style="text-align: left">Command</th> <th style="text-align: left">Description</th> </tr> </thead> <tbody> <tr> <td style="text-align: left"><a href="../volume/index">docker volume</a></td> <td style="text-align: left">Manage volumes</td> </tr> </tbody> </table> <h2 id="related-commands">Related commands</h2> <table> <thead> <tr> <td>Command</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td><a href="../volume_create/index">docker volume create</a></td> <td>Create a volume</td> </tr> <tr> <td><a href="../volume_inspect/index">docker volume inspect</a></td> <td>Display detailed information on one or more volumes</td> </tr> <tr> <td><a href="index">docker volume ls</a></td> <td>List volumes</td> </tr> <tr> <td><a href="../volume_prune/index">docker volume prune</a></td> <td>Remove all unused local volumes</td> </tr> <tr> <td><a href="../volume_rm/index">docker volume rm</a></td> <td>Remove one or more volumes</td> </tr> </tbody> </table> <div class="_attribution"> + <p class="_attribution-p"> + © 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br> + <a href="https://docs.docker.com/engine/reference/commandline/volume_ls/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/volume_ls/</a> + </p> +</div> |
