How to remove docker image

0
(0)

Docker: Delete Image – Delete All Images – Delete Unused

To delete a specific Docker image, first of all, you need to find out its IMAGE_ID by listing all Docker images.
When an image for deletion is defined, it can be deleted using the docker rmi command.

Also, from the command line, you can delete only unused Docker images (unused by any of the containers) or, if necessary, you can force delete all downloaded and locally stored Docker images

List of all local Docker images:

$ docker images

Delete docker image

Delete Docker image by IMAGE ID:

$ docker rmi <image>

Force removal of the Docker image:

$ docker rmi -f <image>

Delete all unused Docker images:

$ docker image prune -a -f

Force delete all Docker images:

$ docker rmi -f $(docker images -q)

Good Tip: If you receive a message stating that it is not possible to delete a Docker image because it is used by a running container or if child images depend on it, try removing the Docker containers first!

Similar Posts:

753

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Scroll to Top