Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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