Skip to content

Instantly share code, notes, and snippets.

@lloiacono
Created May 2, 2017 08:04
Show Gist options
  • Save lloiacono/862c0eac28fdaa874673fa3f42a21ecb to your computer and use it in GitHub Desktop.
Save lloiacono/862c0eac28fdaa874673fa3f42a21ecb to your computer and use it in GitHub Desktop.
Remove unused docker volumes
#!/usr/bin/env bash
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
docker ps -aq | xargs docker inspect | jq -r '.[]|.Mounts|.[]|.Name|select(.)'
) | xargs -r rm -fr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment