Created
July 2, 2022 23:11
-
-
Save guilhermegazzinelli/8f7c2e0b4205914a3617d79d9726ad02 to your computer and use it in GitHub Desktop.
Show the volumes and associated containers
This file contains hidden or 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/sh | |
#!/bin/sh | |
volumes=$(docker volume ls --format '{{.Name}}') | |
dangling=() | |
for volume in $volumes | |
do | |
if result=$(docker ps -a --filter volume="$volume" --format '{{.Names}}' | sed 's/^/ => Used in:/' ) | |
then | |
echo $volume | |
echo $result | |
else | |
dangling+=($volume) | |
fi | |
#echo $dangling | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment