How to Remove a Docker Image?

Better Stack Team
Updated on August 1, 2022

To remove one or more specific images, you can use the docker rmi command.

How to list all images

If you want to list all the images before removing any, you can do they by running the following command:

docker images -a
Copied!

Remove one or more images

If you want to remove an image by name or id, you can do that by running the following command:

docker rmi <image>
Copied!

If you want to remove more images at the same time, just pass all the image names or ids to the command:

docker rmi <image-1> <image-2> <image-3>
Copied!

Remove all images

To remove all docker images, run the following command:

docker rmi $(docker images -a -q)
Copied!
Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack