Created
August 9, 2016 20:30
-
-
Save jeff-kilbride/6385e99766ff57b7e97d6b31ee2e564d to your computer and use it in GitHub Desktop.
Clean up dangling / orphan Docker volumes
This file contains hidden or 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 | |
# Because I keep forgetting this command... | |
DANGLING_VOLUMES=$(docker volume ls -qf dangling=true) | |
if [ -n "$DANGLING_VOLUMES" ]; then | |
echo $'\nRemoving volumes:' | |
docker volume rm $DANGLING_VOLUMES | |
else | |
echo $'\nNo dangling volumes to remove.' | |
fi | |
echo $'\nDone!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment