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%2Fnetwork_ls%2Findex.html | |
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_ls%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_ls%2Findex.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_ls%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_ls%2Findex.html new file mode 100644 index 00000000..44e6cc6b --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_ls%2Findex.html @@ -0,0 +1,72 @@ +<h1>docker network ls</h1> <p><br></p> <p>List networks</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker network 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">Lists all the networks the Engine <code class="language-plaintext highlighter-rouge">daemon</code> knows about. This includes the networks that span across multiple hosts in a cluster.</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. 'driver=bridge')</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--format</code></td> <td></td> <td>Pretty-print networks using a Go template</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--no-trunc</code></td> <td></td> <td>Do not truncate the output</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 network IDs</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="list-all-networks">List all networks</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls +NETWORK ID NAME DRIVER SCOPE +7fca4eb8c647 bridge bridge local +9f904ee27bf5 none null local +cf03ee007fb4 host host local +78b03ee04fc4 multi-host overlay swarm +</pre></div> <p>Use the <code class="language-plaintext highlighter-rouge">--no-trunc</code> option to display the full network id:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --no-trunc +NETWORK ID NAME DRIVER SCOPE +18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3 none null local +c288470c46f6c8949c5f7e5099b5b7947b07eabe8d9a27d79a9cbf111adcbf47 host host local +7b369448dccbf865d397c8d2be0cda7cf7edc6b0945f77d2529912ae917a0185 bridge bridge local +95e74588f40db048e86320c6526440c504650a1ff3e9f7d60a497c4d2163e5bd foo bridge local +63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161 dev bridge local +</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 a <code class="language-plaintext highlighter-rouge">key=value</code> pair. 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>). Multiple filter flags are combined as an <code class="language-plaintext highlighter-rouge">OR</code> filter. For example, <code class="language-plaintext highlighter-rouge">-f type=custom -f type=builtin</code> returns both <code class="language-plaintext highlighter-rouge">custom</code> and <code class="language-plaintext highlighter-rouge">builtin</code> networks.</p> <p>The currently supported filters are:</p> <ul> <li>driver</li> <li>id (network’s id)</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 (network’s name)</li> <li>scope (<code class="language-plaintext highlighter-rouge">swarm|global|local</code>)</li> <li>type (<code class="language-plaintext highlighter-rouge">custom|builtin</code>)</li> </ul> <h4 id="driver">Driver</h4> <p>The <code class="language-plaintext highlighter-rouge">driver</code> filter matches networks based on their driver.</p> <p>The following example matches networks with the <code class="language-plaintext highlighter-rouge">bridge</code> driver:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter driver=bridge +NETWORK ID NAME DRIVER SCOPE +db9db329f835 test1 bridge local +f6e212da9dfd test2 bridge local +</pre></div> <h4 id="id">ID</h4> <p>The <code class="language-plaintext highlighter-rouge">id</code> filter matches on all or part of a network’s ID.</p> <p>The following filter matches all networks with an ID containing the <code class="language-plaintext highlighter-rouge">63d1ff1f77b0...</code> string.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161 +NETWORK ID NAME DRIVER SCOPE +63d1ff1f77b0 dev bridge local +</pre></div> <p>You can also filter for a substring in an ID as this shows:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter id=95e74588f40d +NETWORK ID NAME DRIVER SCOPE +95e74588f40d foo bridge local + +$ docker network ls --filter id=95e +NETWORK ID NAME DRIVER SCOPE +95e74588f40d foo bridge local +</pre></div> <h4 id="label">Label</h4> <p>The <code class="language-plaintext highlighter-rouge">label</code> filter matches networks 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>The following filter matches networks with the <code class="language-plaintext highlighter-rouge">usage</code> label regardless of its value.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls -f "label=usage" +NETWORK ID NAME DRIVER SCOPE +db9db329f835 test1 bridge local +f6e212da9dfd test2 bridge local +</pre></div> <p>The following filter matches networks with the <code class="language-plaintext highlighter-rouge">usage</code> label with the <code class="language-plaintext highlighter-rouge">prod</code> value.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls -f "label=usage=prod" +NETWORK ID NAME DRIVER SCOPE +f6e212da9dfd test2 bridge local +</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 network’s name.</p> <p>The following filter matches all networks with a name containing the <code class="language-plaintext highlighter-rouge">foobar</code> string.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter name=foobar +NETWORK ID NAME DRIVER SCOPE +06e7eef0a170 foobar bridge local +</pre></div> <p>You can also filter for a substring in a name as this shows:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter name=foo +NETWORK ID NAME DRIVER SCOPE +95e74588f40d foo bridge local +06e7eef0a170 foobar bridge local +</pre></div> <h4 id="scope">Scope</h4> <p>The <code class="language-plaintext highlighter-rouge">scope</code> filter matches networks based on their scope.</p> <p>The following example matches networks with the <code class="language-plaintext highlighter-rouge">swarm</code> scope:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter scope=swarm +NETWORK ID NAME DRIVER SCOPE +xbtm0v4f1lfh ingress overlay swarm +ic6r88twuu92 swarmnet overlay swarm +</pre></div> <p>The following example matches networks with the <code class="language-plaintext highlighter-rouge">local</code> scope:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter scope=local +NETWORK ID NAME DRIVER SCOPE +e85227439ac7 bridge bridge local +0ca0e19443ed host host local +ca13cc149a36 localnet bridge local +f9e115d2de35 none null local +</pre></div> <h4 id="type">Type</h4> <p>The <code class="language-plaintext highlighter-rouge">type</code> filter supports two values; <code class="language-plaintext highlighter-rouge">builtin</code> displays predefined networks (<code class="language-plaintext highlighter-rouge">bridge</code>, <code class="language-plaintext highlighter-rouge">none</code>, <code class="language-plaintext highlighter-rouge">host</code>), whereas <code class="language-plaintext highlighter-rouge">custom</code> displays user defined networks.</p> <p>The following filter matches all user defined networks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --filter type=custom +NETWORK ID NAME DRIVER SCOPE +95e74588f40d foo bridge local +63d1ff1f77b0 dev bridge local +</pre></div> <p>By having this flag it allows for batch cleanup. For example, use this filter to delete all user defined networks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network rm `docker network ls --filter type=custom -q` +</pre></div> <p>A warning will be issued when trying to remove a network that has containers attached.</p> <h3 id="formatting">Formatting</h3> <p>The formatting options (<code class="language-plaintext highlighter-rouge">--format</code>) pretty-prints networks 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">.ID</code></td> <td>Network ID</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Network name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Driver</code></td> <td>Network driver</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Scope</code></td> <td>Network scope (local, global)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.IPv6</code></td> <td>Whether IPv6 is enabled on the network or not.</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Internal</code></td> <td>Whether the network is internal or not.</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Labels</code></td> <td>All labels assigned to the network.</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Label</code></td> <td>Value of a specific label for this network. For example <code class="language-plaintext highlighter-rouge">{{.Label "project.version"}}</code> +</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.CreatedAt</code></td> <td>Time when the network was created</td> </tr> </tbody> </table> <p>When using the <code class="language-plaintext highlighter-rouge">--format</code> option, the <code class="language-plaintext highlighter-rouge">network 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">ID</code> and <code class="language-plaintext highlighter-rouge">Driver</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all networks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls --format "{{.ID}}: {{.Driver}}" +afaaab448eb2: bridge +d1584f8dc718: host +391df270dc66: null +</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="../network/index">docker network</a></td> <td style="text-align: left">Manage networks</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="../network_connect/index">docker network connect</a></td> <td>Connect a container to a network</td> </tr> <tr> <td><a href="../network_create/index">docker network create</a></td> <td>Create a network</td> </tr> <tr> <td><a href="../network_disconnect/index">docker network disconnect</a></td> <td>Disconnect a container from a network</td> </tr> <tr> <td><a href="../network_inspect/index">docker network inspect</a></td> <td>Display detailed information on one or more networks</td> </tr> <tr> <td><a href="index">docker network ls</a></td> <td>List networks</td> </tr> <tr> <td><a href="../network_prune/index">docker network prune</a></td> <td>Remove all unused networks</td> </tr> <tr> <td><a href="../network_rm/index">docker network rm</a></td> <td>Remove one or more networks</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/network_ls/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/network_ls/</a> + </p> +</div> |
