Created
July 15, 2015 01:44
-
-
Save maxclaus/e33134fbe6db97129ffc to your computer and use it in GitHub Desktop.
Script to remove orphaned docker volumes
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 | |
# Usage: | |
# - To only show the possbible volumes to be removed: | |
# ./docker-cleanup-volumes.sh | |
# - To remove orphaned docker volumes: | |
# ./docker-cleanup-volumes.sh clean | |
if [ "$1" == 'clean' ]; then | |
echo "cleaning..." | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes | |
else | |
echo "showing..." | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes --dry-run | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment