question: delete docker images with none tag.
sample output:
hfyin@hfyin-VirtualBox:~/projects$ docker image ls | grep none
<none> <none> 9df7104f4ba5 2 months ago 109MB
<none> <none> b003f9ad8bca 2 months ago 109MB
normally with cut command, i can get image id, but this time it fail due to the output has multiple blankspace. The solution is firstly replace repeated space with only one space using tr command, then use cut command.
$ docker image ls | grep none | tr -s ' ' | cut -d' ' -f3
9df7104f4ba5
then to delete docker image using xargs as:
$ docker image ls | grep none | tr -s ' ' | cut -d' ' -f3 | xargs docker image rm
refer: