feat: add script to remove untagged images

When using docker all the time to develop new images it is common to
leave a lot of untagged images behind. The
`docker_remove_untagged_img.sh` removes all docker images from local
storage that are not currently assigned to any tag
This commit is contained in:
Manuel Castellin 2020-02-28 18:27:11 +00:00
parent ba21581030
commit c4fcaa280d

11
docker_remove_untagged_img.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
if [ ! "$(docker images | grep "^<none>" | awk '{print $3}')" ]; then
echo "No untagged images to remove. Exiting."
exit 0
fi
echo "Removing all untagged images..."
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
echo "Done."