Removing all images in Docker

February 08, 2019

The way Docker handles images can't be relied on all the time. In some case you really need to get rid of any trace of an image you're using, just so your new environment variables are applied, and that's just one case of why you might want to delete all your Docker images.

Delete all images that aren't being used:

docker rmi $(docker images -a -q)

Force delete all images:

docker rmi $(docker images -a -q) -f

List all images:

docker images -a

Remove multiple specific images:

docker rmi IMAGE1_ID IMAGE2_ID