summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html
new file mode 100644
index 00000000..0e57681a
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fcontainer_prune%2Findex.html
@@ -0,0 +1,51 @@
+<h1>docker container prune</h1> <p><br></p> <p>Remove all stopped containers</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker container 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">Removes all stopped 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=&lt;timestamp&gt;')</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> <h3 id="prune-containers">Prune containers</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker container prune
+WARNING! This will remove all stopped containers.
+Are you sure you want to continue? [y/N] y
+Deleted Containers:
+4a7f7eebae0f63178aff7eb0aa39cd3f0627a203ab2df258c1a00b456cf20063
+f98f9c2aa1eaf727e4ec9c0283bc7d4aa4762fbdba7f26191f26c97f64090360
+
+Total reclaimed space: 212 B
+</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">&lt;timestamp&gt;</code>) - only remove containers created before given timestamp</li> <li>label (<code class="language-plaintext highlighter-rouge">label=&lt;key&gt;</code>, <code class="language-plaintext highlighter-rouge">label=&lt;key&gt;=&lt;value&gt;</code>, <code class="language-plaintext highlighter-rouge">label!=&lt;key&gt;</code>, or <code class="language-plaintext highlighter-rouge">label!=&lt;key&gt;=&lt;value&gt;</code>) - only remove containers 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=&lt;key&gt;</code> or <code class="language-plaintext highlighter-rouge">label=&lt;key&gt;=&lt;value&gt;</code>), which removes containers with the specified labels. The other format is the <code class="language-plaintext highlighter-rouge">label!=...</code> (<code class="language-plaintext highlighter-rouge">label!=&lt;key&gt;</code> or <code class="language-plaintext highlighter-rouge">label!=&lt;key&gt;=&lt;value&gt;</code>), which removes containers without the specified labels.</p> <p>The following removes containers created more than 5 minutes ago:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
+
+CONTAINER ID IMAGE COMMAND CREATED AT STATUS
+61b9efa71024 busybox "sh" 2017-01-04 13:23:33 -0800 PST Exited (0) 41 seconds ago
+53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 12 minutes ago
+
+$ docker container prune --force --filter "until=5m"
+
+Deleted Containers:
+53a9bc23a5168b6caa2bfbefddf1b30f93c7ad57f3dec271fd32707497cb9369
+
+Total reclaimed space: 25 B
+
+$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
+
+CONTAINER ID IMAGE COMMAND CREATED AT STATUS
+61b9efa71024 busybox "sh" 2017-01-04 13:23:33 -0800 PST Exited (0) 44 seconds ago
+</pre></div> <p>The following removes containers created before <code class="language-plaintext highlighter-rouge">2017-01-04T13:10:00</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
+
+CONTAINER ID IMAGE COMMAND CREATED AT STATUS
+53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 7 minutes ago
+4a75091a6d61 busybox "sh" 2017-01-04 13:09:53 -0800 PST Exited (0) 9 minutes ago
+
+$ docker container prune --force --filter "until=2017-01-04T13:10:00"
+
+Deleted Containers:
+4a75091a6d618526fcd8b33ccd6e5928ca2a64415466f768a6180004b0c72c6c
+
+Total reclaimed space: 27 B
+
+$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
+
+CONTAINER ID IMAGE COMMAND CREATED AT STATUS
+53a9bc23a516 busybox "sh" 2017-01-04 13:11:59 -0800 PST Exited (0) 9 minutes ago
+</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="../container/index">docker container</a></td> <td style="text-align: left">Manage containers</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="../container_attach/index">docker container attach</a></td> <td>Attach local standard input, output, and error streams to a running container</td> </tr> <tr> <td><a href="../container_commit/index">docker container commit</a></td> <td>Create a new image from a container’s changes</td> </tr> <tr> <td><a href="../container_cp/index">docker container cp</a></td> <td>Copy files/folders between a container and the local filesystem</td> </tr> <tr> <td><a href="../container_create/index">docker container create</a></td> <td>Create a new container</td> </tr> <tr> <td><a href="../container_diff/index">docker container diff</a></td> <td>Inspect changes to files or directories on a container’s filesystem</td> </tr> <tr> <td><a href="../container_exec/index">docker container exec</a></td> <td>Run a command in a running container</td> </tr> <tr> <td><a href="../container_export/index">docker container export</a></td> <td>Export a container’s filesystem as a tar archive</td> </tr> <tr> <td><a href="../container_inspect/index">docker container inspect</a></td> <td>Display detailed information on one or more containers</td> </tr> <tr> <td><a href="../container_kill/index">docker container kill</a></td> <td>Kill one or more running containers</td> </tr> <tr> <td><a href="../container_logs/index">docker container logs</a></td> <td>Fetch the logs of a container</td> </tr> <tr> <td><a href="../container_ls/index">docker container ls</a></td> <td>List containers</td> </tr> <tr> <td><a href="../container_pause/index">docker container pause</a></td> <td>Pause all processes within one or more containers</td> </tr> <tr> <td><a href="../container_port/index">docker container port</a></td> <td>List port mappings or a specific mapping for the container</td> </tr> <tr> <td><a href="index">docker container prune</a></td> <td>Remove all stopped containers</td> </tr> <tr> <td><a href="../container_rename/index">docker container rename</a></td> <td>Rename a container</td> </tr> <tr> <td><a href="../container_restart/index">docker container restart</a></td> <td>Restart one or more containers</td> </tr> <tr> <td><a href="../container_rm/index">docker container rm</a></td> <td>Remove one or more containers</td> </tr> <tr> <td><a href="../container_run/index">docker container run</a></td> <td>Run a command in a new container</td> </tr> <tr> <td><a href="../container_start/index">docker container start</a></td> <td>Start one or more stopped containers</td> </tr> <tr> <td><a href="../container_stats/index">docker container stats</a></td> <td>Display a live stream of container(s) resource usage statistics</td> </tr> <tr> <td><a href="../container_stop/index">docker container stop</a></td> <td>Stop one or more running containers</td> </tr> <tr> <td><a href="../container_top/index">docker container top</a></td> <td>Display the running processes of a container</td> </tr> <tr> <td><a href="../container_unpause/index">docker container unpause</a></td> <td>Unpause all processes within one or more containers</td> </tr> <tr> <td><a href="../container_update/index">docker container update</a></td> <td>Update configuration of one or more containers</td> </tr> <tr> <td><a href="../container_wait/index">docker container wait</a></td> <td>Block until one or more containers stop, then print their exit codes</td> </tr> </tbody> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 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/container_prune/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/container_prune/</a>
+ </p>
+</div>