ADVERTISEMENT

In this simple tutorial, I write a tutorial about how to remove image from Docker. Follow these steps to remove image from Docker.

Show All Images

docker images

Above command will give you all images on Docker. For example:

 Docker Images

Docker Images

Remove Image

To remove an image, you have to know the ID of image that you want to remove. Then execute this command:

docker rmi IMAGE_ID

Change IMAGE_ID with ID of image that you want to remove.

For example, I want to remove hello-world image that has image ID 690ed74de00f (See above picture). So the command that I use to remove hello-world image is:

docker rmi 690ed74de00f

After you execute the command, you will see like this:

 Removing Docker Images

Removing Docker Images

It means the image successfully removed.

But when you remove an images and get result for example:

Failed to remove image (690ed74de00f): Error response from daemon: conflict: unable to delete 690ed74de00f (must be forced) – image is being used by stopped container e3ea2b56c4a6

It means the image that you remove is used by container. So if you want to remove the image, make sure the image is not used by container.

ADVERTISEMENT