Skip to content

Instantly share code, notes, and snippets.

@jeff-kilbride
Created August 9, 2016 20:30
Show Gist options
  • Save jeff-kilbride/6385e99766ff57b7e97d6b31ee2e564d to your computer and use it in GitHub Desktop.
Save jeff-kilbride/6385e99766ff57b7e97d6b31ee2e564d to your computer and use it in GitHub Desktop.
Clean up dangling / orphan Docker volumes
#!/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