Created
April 26, 2019 21:05
-
-
Save spkellydev/7fcf48852d5e76cbd240bca1509bccbd to your computer and use it in GitHub Desktop.
Prune all docker images for a specific repo where the tag does not equal "latest"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker images --format 'table {{.Repository}}\t{{.Tag}}\t{{.ID}}' \ # custom docker ps | |
| grep repository/image \ # get the repository | |
| grep -v latest \ # get all repositories which are not tagged latest | |
| awk '{print $3}' \ # get the ID (third column) of the image | |
| xargs docker rmi # delete image |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment