How to delete a docker image

0 votes

A Dockerfile is included in my project to create an image. I've tweaked that Dockerfile and want to verify whether it still works. So I quit my program and used docker image ls -a in Powershell to list all of my Docker images. Using docker rmi -f $(docker images -a -q) and docker image prune -a and  I deleted all unnecessary images.

However, instead of being erased, the image is merely 'untagged':

Untagged: my_image:latest
Untagged: my_image@sha256:16eb92a476be0...

Before attempting to erase the picture, all containers are stopped and removed.
When I restart my application to create a new image, it continues to use the old one:

> docker image ls -a
REPOSITORY                     TAG           IMAGE ID            CREATED      
/my_image                      latest        0d79904a74b0        1 months ago

How can I physically delete the old image so that my app can create a fresh one?

Apr 21, 2022 in Docker by pranav
• 2,590 points
719 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
To begin, you must first delete or stop the container that is currently using your image (which one you want to remove).

To see all the running containers on your machine, type docker ps -a.
docker stop container_id: This command is used to terminate a running container.
docker rm container_id: To delete or remove a docker container (only if it stopped).
To get a list of all accessible images, including their tag, image id, creation time, and size, run docker image ls.
To delete a specific image, run rmi docker image_id.

To destroy a specific image, run docker image rm image_name.
To remove the image, you must first remove or stop all containers that use it.

docker system prune -a: Removes all containers and images from the Docker environment.
answered Apr 27, 2022 by Abhijeet
• 180 points

edited Mar 5

Related Questions In Docker

+1 vote
1 answer

How to push a docker image to a private repository

You need to tag your image correctly ...READ MORE

answered Jul 26, 2018 in Docker by Kalgi
• 52,350 points
2,571 views
+4 votes
4 answers

How to install packages inside a docker Ubuntu image?

Execute the update and the install command ...READ MORE

answered Apr 24, 2019 in Docker by Vismaya
48,063 views
0 votes
1 answer

How do I delete the build cache for a docker image?

You could try this inorder to clean ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
12,842 views
0 votes
1 answer

How to push a docker image onto the Azure Container Registry (ACR)?

Before pushing local Docker image to ACR, ...READ MORE

answered Jul 4, 2019 in Docker by Sirajul
• 59,230 points
5,783 views
0 votes
1 answer
0 votes
1 answer

How to save a Docker image in tar file?

docker save -o image name READ MORE

answered Sep 8, 2022 in Docker by anonymous

edited Mar 5 4,655 views
+2 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
4,465 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP