- First, list all the Docker images on your system to find the image you want to delete. Run the following command:
- Locate the image you want to delete in the list. Take note of the IMAGE ID or the REPOSITORY:TAG for that image.
- To delete the image, run the following command using either the IMAGE ID or the REPOSITORY:TAG:
docker rmi <IMAGE_ID>
docker rmi <REPOSITORY:TAG>
<REPOSITORY:TAG> with the appropriate value for the image you want to delete.
- The command should return a message indicating that the image has been deleted successfully. You can run
docker imagesagain to confirm that the image is no longer listed.
Important: Before deleting an image, make sure no containers are using it. If a container is using the image, you will need to stop and remove the container first