Deleting Images

Learn how to delete Docker images.

We'll cover the following

We can delete images using the docker rmi command. rmi is short for remove image. Deleting images removes them from our local repository, and they will no longer appear in our docker images commands. The operation also deletes all directories on the local filesystem containing layer data. However, Docker won’t delete layers shared by multiple images until we delete all images that reference them.

We can delete images by name, short ID, or SHA. We can also delete multiple images with the same command.

The following command deletes three images—one by name, one by short ID, and one by SHA. We trimmed the output for easier reading.

Get hands-on with 1200+ tech skills courses.