The blog about containerisation, virtual machines and useful shell snippets and findings

Remove stale docker images of your app

Check your images list with

docker images

and find your latest image sha, in my case 269...
Then use this string, where your app image is registry.it-expert.com.ua/nexus/it-service

docker images -f=reference='registry.it-expert.com.ua/nexus/it-service*:*' -f before=269 -q | xargs docker rmi

This will remove all your previous images, which was created before selected image.

You can also use

docker images -f=dangling=true

to find all stale images.