<p>I have two below docker commands, can someone let me know the equivalent <code>kubernetes</code> (<code>kubectl</code>) command for single node cluster :</p>
<pre><code>docker image prune -a --force --filter until=5m
docker container prune --force --filter until=5m
</code></pre>
<p>Also are these two commands doing same thing ? I understand that first one is deleting image and second one is deleting container, but I am not sure about extra params like <code>-a</code> , <code>--force</code> and <code>--filter</code> are doing.</p>

solveit
<blockquote>
<p>can someone let me know the equivalent kubernetes (kubectl) command for single node cluster</p>
<pre><code>docker image prune -a --force --filter until=5m
docker container prune --force --filter until=5m
</code></pre>
</blockquote>
<p>You don't directly interact with the docker containers or images on the nodes themselves, and you shouldn't have to. There is no direct equivalent on kubectl. If you wanted to run a prune on the nodes to (for example), save space, then you could setup a cronjob on the node itself to do this -- Kubernetes does not support this functionality.</p>
<p>If you are trying to do this to force Kubernetes to pull a new version of the image and not used the cached version, then you can just use the <code>imagePullPolicy</code> directive (<a href="https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy" rel="nofollow noreferrer">documentation</a>) to force Kubernetes to attempt to pull a new version each time</p>
<p>What are you trying to achieve by pruning the images on the nodes?</p>
<blockquote>
<p>Also are these two commands doing same thing ?</p>
</blockquote>
<p>No, they are not doing the same thing. Docker works with images. You build or pull an image, and to run it, you create a container. You can have multiple containers that run the same image, but you can only have one of that image.</p>
<p><code>--force</code> will no prompt for confirmation before deleting (so the usual &quot;be careful&quot; warning applies here)</p>
<p><code>-a</code> or <code>--all</code> will remove all unused images, not just dangling ones. <a href="https://stackoverflow.com/a/45143234/2017590">This answer</a> explains the difference between a dangling and unused image.</p>
<p>You can also use the <code>--help</code> switch to get details on what the commands do and their accepted options:</p>
<pre><code>$ docker image prune --help

Usage:  docker image prune [OPTIONS]

Remove unused images

Options:
  -a, --all             Remove all unused images, not just dangling ones
      --filter filter   Provide filter values (e.g. 'until=&lt;timestamp&gt;')
  -f, --force           Do not prompt for confirmation
</code></pre>
<pre><code>$ docker container prune --help

Usage:  docker container prune [OPTIONS]

Remove all stopped containers

Options:
      --filter filter   Provide filter values (e.g. 'until=&lt;timestamp&gt;')
  -f, --force           Do not prompt for confirmation
</code></pre>
