I want to remove all tags on a given docker repository locally. For example, if I had two tags on a repo called "my_image:latest" and "my_image:sometag" I would want to remove both of those tags. However, I do not want to remove "another_image:latest".
To list the images you want to remove:
$ docker images --filter='reference=my_image' --format='{{.Repository}}:{{.Tag}}'
To delete them as well, combine with docker rmi
:
$ docker images --filter='reference=my_image' --format='{{.Repository}}:{{.Tag}}' | xargs docker rmi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With