<p>My project includes a Dockerfile to build an image. I've made modifications to that Dockerfile and want to see if it works. So i closed my program and listed all docker images in powershell using <code>docker image ls -a</code>. I deletetd all unused images using <code>docker rmi -f $(docker images -a -q)</code> and <code>docker image prune -a</code>.</p>
<p>But my image keeps <strong>not</strong> getting deleted, but simply 'untagged':</p>
<pre><code>Untagged: my_image:latest
Untagged: my_image@sha256:16eb92a476be0...
</code></pre>
<p>All containers are stopped and deleted before trying to remove the image.<br />
When i restart my application to build a new image, the old one keeps getting used:</p>
<pre><code>&gt; docker image ls -a
REPOSITORY                     TAG           IMAGE ID            CREATED      
/my_image                      latest        0d79904a74b0        2 months ago
</code></pre>
<p>How do i actually physically remove the old image so my application can build a new one?</p>

tdragojevic
<p>At first, you need to delete/stop the running container that is using your image(which one you want to remove).</p>
<ul>
<li><code>docker ps -a</code>: To see all the running containers in your machine.</li>
<li><code>docker stop &lt;container_id&gt;</code>: To stop a running container.</li>
<li><code>docker rm &lt;container_id&gt;</code>: To remove/delete a docker container(only if it stopped).</li>
<li><code>docker image ls</code>: To see the list of all the available images with their tag, image id, creation time and size.</li>
<li><code>docker rmi &lt;image_id&gt;</code>: To delete a specific image.</li>
<li><code>docker rmi -f &lt;image_id&gt;</code>: To delete a docker image forcefully</li>
<li><code>docker rm -f (docker ps -a | awk '{print$1}')</code>: To delete all the docker container available in your machine</li>
<li><code>docker image rm &lt;image_name&gt;</code>: To delete a specific image</li>
</ul>
<p>To remove the image, you have to remove/stop all the containers which are using it.</p>
<ul>
<li><code>docker system prune -a</code>: To clean the docker environment, removing all the containers and images.</li>
</ul>
