How to remove image from Docker registry
By Richard | 11/Oct/2024
Docker is a container platform provider to address every application across the hybrid cloud. In other words, Docker makes it easy to wrap your apps and services in containers so you can run them anywhere. However, it's also easy to accumulate a bunch of useless and unnecessary images and waste space in your registry.
An image may be deleted from the registry via its name and reference. This combination links hashes of image layers and the command would be like this:
DELETE /v2//manifests/
So, to delete image, we need to find correct repository name, image tag and then list corresponding image hashes (the reference).
If the image exists and has been successfully deleted, the following response will be issued:
202 Accepted
Content-Length: None
If the image had already been deleted or did not exist, a 404 Not Found response will be issued instead.
Speaking of removing Docker images, there’s one more kind, the dangling images. Docker images consist of multiple layers, and dangling images are layers that have no connection to any tagged images. They do not serve a purpose and consume disk space.
If you want to remove all the Docker images, they could be listed by adding “-a” to the “docker images” command, and then add the “-q” flag to pass the Image ID to “docker rmi”:
This guide covers some of the common commands used to remove images in the Docker to save some space in the registry. Actually, Docker gives you all the tools you need to clean up your system from the command line.
If you want to remove unused registry on your computer, Neptune SystemCare Ultimate is recommended, which has both the easy mode for regular users, and the tech-savvy way for advanced users.