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

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>

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>

Remove all images

To remove all docker images, run the following command:

 
docker rmi $(docker images -a -q)

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github