Skip to content

Instantly share code, notes, and snippets.

@matchy256
Created May 20, 2016 04:38
Show Gist options
  • Save matchy256/977fffed80770bf4ec99cc77bc2e3e7e to your computer and use it in GitHub Desktop.
Save matchy256/977fffed80770bf4ec99cc77bc2e3e7e to your computer and use it in GitHub Desktop.
docker で使っていないデータボリュームを一括削除する
#!/bin/bash
function do_cleanup {
docker volume rm $(docker volume ls -qf dangling=true)
}
LIST=`docker volume ls -qf dangling=true`
if [ -n "$LIST" ]; then
echo $LIST
echo "Cleanup ? (y/N)"
read answer
case $answer in
y)
do_cleanup
;;
Y)
do_cleanup
;;
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment