<p>I read before questions like <a href="https://stackoverflow.com/q/56867829">Unable to delete all pods in Kubernetes - Clear/restart Kubernetes</a> or <a href="https://stackoverflow.com/q">https://stackoverflow.com/q</a></p>
<p>Someone says it is a duplicate, but <strong>its answers aren't working for me</strong>!</p>
<p>I'm trying to delete images:</p>
<pre class="lang-sh prettyprint-override"><code>joseluisbz@Joses-MacBook-Air ~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c0fe6040a78c        1d0a3365fc79        &quot;/usr/sbin/nginx -g …&quot;   4 minutes ago       Up 4 minutes                            k8s_nginx_nginx1_default_485fea96-b84c-4713-bcf7-38d2a48e612b_3
joseluisbz@Joses-MacBook-Air ~ % docker system prune -a
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
joseluisbz@Joses-MacBook-Air ~ % docker system prune -a
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
joseluisbz@Joses-MacBook-Air ~ % docker rmi -f 1d0a3365fc79
Error response from daemon: conflict: unable to delete 1d0a3365fc79 (cannot be forced) - image is being used by running container c0fe6040a78c
joseluisbz@Joses-MacBook-Air ~ %
</code></pre>
<p>Again:</p>
<pre class="lang-sh prettyprint-override"><code>joseluisbz@Joses-MacBook-Air ~ % docker rm -f $(docker ps -a -q --filter &quot;name=k8s&quot;)
c0fe6040a78c
joseluisbz@Joses-MacBook-Air ~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c752de53440e        1d0a3365fc79        &quot;/usr/sbin/nginx -g …&quot;   17 seconds ago      Up 17 seconds                           k8s_nginx_nginx1_default_485fea96-b84c-4713-bcf7-38d2a48e612b_0
joseluisbz@Joses-MacBook-Air ~ %
</code></pre>
<p>I stop the container but unfortunately restart again.</p>
<pre class="lang-yaml prettyprint-override"><code>joseluisbz@Joses-MacBook-Air ~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
edacfbcb8a35        1d0a3365fc79        &quot;/usr/sbin/nginx -g …&quot;   5 minutes ago       Up 5 minutes                            k8s_nginx_nginx1_default_485fea96-b84c-4713-bcf7-38d2a48e612b_3
joseluisbz@Joses-MacBook-Air ~ % docker stop edacfbcb8a35
edacfbcb8a35
joseluisbz@Joses-MacBook-Air ~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
joseluisbz@Joses-MacBook-Air ~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
e2d695258f98        1d0a3365fc79        &quot;/usr/sbin/nginx -g …&quot;   3 seconds ago       Up 2 seconds                            k8s_nginx_nginx1_default_485fea96-b84c-4713-bcf7-38d2a48e612b_4
joseluisbz@Joses-MacBook-Air ~ %
</code></pre>
<p><strong>Is there another method in order to delete the image and avoid auto-restart container?</strong></p>
<p>EDIT 1:
<a href="https://i.stack.imgur.com/VIHw0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VIHw0.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/fZDdd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fZDdd.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/oTqe9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oTqe9.png" alt="enter image description here" /></a></p>
<p>Unfortunatelly</p>
<p><a href="https://i.stack.imgur.com/cUnp3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cUnp3.png" alt="enter image description here" /></a></p>

<p>Did you check all namespaces in Kubernetes to see if any pod is running when the container is running?</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get pods --all-namespaces
</code></pre>
<p>If not then you might have an <a href="https://docs.docker.com/engine/reference/run/#restart-policies---restart" rel="nofollow noreferrer">auto-restart</a> on a specific docker container. In which case you can do:</p>
<pre class="lang-sh prettyprint-override"><code>docker update --restart=no &lt;container_id&gt;
</code></pre>
<p>Worse case you can go nuclear 💥💣 and delete and reinstall docker on your Mac.</p>
<p>EDIT:</p>
<p>Looks like have a couple of deployments that are probably causing containers to restart <code>compose</code>, <code>compose-api</code>. You can try deleting them 💥💣:</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl -n docker delete deploy compose compose-api
</code></pre>
