Created
October 20, 2017 07:01
-
-
Save joonahn/fe687096b371a38745ffdb2bbeee45be to your computer and use it in GitHub Desktop.
Remove unused 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 | |
sudo find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <( | |
docker ps -aq | xargs docker inspect | jq -r '.[] | .Mounts | .[] | .Name | select(.)' | |
) | sudo xargs -r rm -fr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment