DEV Community

Cover image for delete all <none> image on docker with single command πŸ–₯️
arsannnnn
arsannnnn

Posted on • Updated on

delete all <none> image on docker with single command πŸ–₯️

Ciao!

If docker images being failed to run certain command, <none> images will be generated and it can be very annoying.

This is how to easy delete it.

Delete Container.

If the <none> images were used on container, active or not, you have to delete it first.

To list all containers, run this command on your terminal:

docker ps -a
Enter fullscreen mode Exit fullscreen mode

To delete it, run this command. Make sure you delete container with <none> image.

docker container rm <your-container-name>
Enter fullscreen mode Exit fullscreen mode

Delete All <none> Images.

You can delete all those images just with this single line command.

docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
Enter fullscreen mode Exit fullscreen mode

That's it. Thanks for reading!

Top comments (0)