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!
- Docker: Launching a Container from an Image
- Stop and remove all docker containers
- How to install docker on Debian 9 Stretch
- Install redmine via docker-compose
- Installing Docker on Ubuntu-18.04!