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_prune%2Findex.html | |
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_prune%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_prune%2Findex.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_prune%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_prune%2Findex.html new file mode 100644 index 00000000..cd81b45a --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fnetwork_prune%2Findex.html @@ -0,0 +1,37 @@ +<h1>docker network prune</h1> <p><br></p> <p>Remove all unused networks</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker network prune [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">Remove all unused networks. Unused networks are those which are not referenced by any containers.</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></td> <td></td> <td>Provide filter values (e.g. 'until=<timestamp>')</td> </tr> <tr> <td> +<code class="language-plaintext highlighter-rouge">--force</code> , <code class="language-plaintext highlighter-rouge">-f</code> +</td> <td></td> <td>Do not prompt for confirmation</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker network prune + +WARNING! This will remove all custom networks not used by at least one container. +Are you sure you want to continue? [y/N] y +Deleted Networks: +n1 +n2 +</pre></div> <h3 id="filtering">Filtering</h3> <p>The filtering flag (<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>until (<code class="language-plaintext highlighter-rouge"><timestamp></code>) - only remove networks created before given timestamp</li> <li>label (<code class="language-plaintext highlighter-rouge">label=<key></code>, <code class="language-plaintext highlighter-rouge">label=<key>=<value></code>, <code class="language-plaintext highlighter-rouge">label!=<key></code>, or <code class="language-plaintext highlighter-rouge">label!=<key>=<value></code>) - only remove networks with (or without, in case <code class="language-plaintext highlighter-rouge">label!=...</code> is used) the specified labels.</li> </ul> <p>The <code class="language-plaintext highlighter-rouge">until</code> filter can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. <code class="language-plaintext highlighter-rouge">10m</code>, <code class="language-plaintext highlighter-rouge">1h30m</code>) computed relative to the daemon machine’s time. Supported formats for date formatted time stamps include RFC3339Nano, RFC3339, <code class="language-plaintext highlighter-rouge">2006-01-02T15:04:05</code>, <code class="language-plaintext highlighter-rouge">2006-01-02T15:04:05.999999999</code>, <code class="language-plaintext highlighter-rouge">2006-01-02Z07:00</code>, and <code class="language-plaintext highlighter-rouge">2006-01-02</code>. The local timezone on the daemon will be used if you do not provide either a <code class="language-plaintext highlighter-rouge">Z</code> or a <code class="language-plaintext highlighter-rouge">+-00:00</code> timezone offset at the end of the timestamp. When providing Unix timestamps enter seconds[.nanoseconds], where seconds is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a fraction of a second no more than nine digits long.</p> <p>The <code class="language-plaintext highlighter-rouge">label</code> filter accepts two formats. One is the <code class="language-plaintext highlighter-rouge">label=...</code> (<code class="language-plaintext highlighter-rouge">label=<key></code> or <code class="language-plaintext highlighter-rouge">label=<key>=<value></code>), which removes networks with the specified labels. The other format is the <code class="language-plaintext highlighter-rouge">label!=...</code> (<code class="language-plaintext highlighter-rouge">label!=<key></code> or <code class="language-plaintext highlighter-rouge">label!=<key>=<value></code>), which removes networks without the specified labels.</p> <p>The following removes networks created more than 5 minutes ago. Note that system networks such as <code class="language-plaintext highlighter-rouge">bridge</code>, <code class="language-plaintext highlighter-rouge">host</code>, and <code class="language-plaintext highlighter-rouge">none</code> will never be pruned:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker network ls + +NETWORK ID NAME DRIVER SCOPE +7430df902d7a bridge bridge local +ea92373fd499 foo-1-day-ago bridge local +ab53663ed3c7 foo-1-min-ago bridge local +97b91972bc3b host host local +f949d337b1f5 none null local + +$ docker network prune --force --filter until=5m + +Deleted Networks: +foo-1-day-ago + +$ docker network ls + +NETWORK ID NAME DRIVER SCOPE +7430df902d7a bridge bridge local +ab53663ed3c7 foo-1-min-ago bridge local +97b91972bc3b host host local +f949d337b1f5 none null 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="../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="../network_ls/index">docker network ls</a></td> <td>List networks</td> </tr> <tr> <td><a href="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_prune/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/network_prune/</a> + </p> +</div> |
