This article will provide how to delete multiple images on Docker.
How to Delete Multiple Images on Docker?
Docker images are heavy in size and can take much of your system space and slow down the system. Users can delete unused, dangling images from the Docker platform by utilizing the listed instructions.
Step 1: List All Images
First, list down all the images using the “docker images” command. Here, the “-a” option is specifically used to list all images in Docker. Note the image id you are needed to remove from the “Image ID” column:
Step 2: Remove Multiple Images
Next, remove multiple images through the “docker rmi <image-id-1>, <image-id-2>” command. Here, “-f” is used to remove the image forcefully:
Here, you can see we have successfully deleted the multiple images from “docker rmi” command:
Bonus Tip: Remove All Images in Docker
In order to remove all unused images from the Docker platform, go through the provided command. Here “-q” is used to access the image by id:
For the verification, again list down all the images and check whether the images are removed or not:
It can be noticed that we have successfully removed the images from Docker:
That’s all! We have demonstrated how to remove multiple images from Docker.
Conclusion
To delete multiple images on the Docker platform, utilize the “docker rmi -f <image-id 1> <image-id 2>” command. In order to remove all dangling and unused images, you can execute the “docker rmi $(docker images -q)” command. This write-up has demonstrated how to delete or remove multiple images on Docker.