mirror of
https://github.com/gdiepen/docker-convenience-scripts.git
synced 2025-03-10 11:30:23 +00:00
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:
parent
ba21581030
commit
c4fcaa280d
1 changed files with 11 additions and 0 deletions
11
docker_remove_untagged_img.sh
Executable file
11
docker_remove_untagged_img.sh
Executable 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."
|
Loading…
Add table
Reference in a new issue