Quick Tip: List docker images sorted by size
The docker image ls command has an option for filtering output but what if we want to sort the images to find the really hefty ones? You know, the ones that might need to go the way of Old Yeller.
Huh? What’s that, docker? You can’t do that.
If you want something done right…
It ain’t pretty but it works.
docker image ls --format "{{.Repository}}:{{.Tag}} {{.Size}}" | \ awk '{if ($2~/GB/) print substr($2, 1, length($2)-2) * 1000 "MB - " $1 ; else print $2 " - " $1 }' | \ sed '/^0/d' | \ sort -n Side Note
[Read More]