Created
August 29, 2021 15:24
-
-
Save A-725-K/f764ca18e7b4be9d9a99d97649ed3ee3 to your computer and use it in GitHub Desktop.
Utility to clean all the <none> images accumulated in docker
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
#!/bin/bash | |
images=$(docker image ls | tail +2 | grep '<none>' | awk '{print $3}') | |
echo -e "*** This script will remove the following <none> images: ***\n\n$images\n" | |
read -p 'Are you sure? [y/N] ' choice | |
if [[ $choice == "y" ]] || [[ $choice == "Y" ]]; then | |
echo -e "\nRemoving the images" | |
docker image rm $images | |
else | |
echo -e "\nAborting the operation..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment