Added first version of data volume information script
rodzic
8bfc28ca03
commit
b4c25c1871
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
echo "List of all volumes:"
|
||||
for docker_volume_id in $(docker volume ls -q)
|
||||
do
|
||||
echo " (Un)named volume: ${docker_volume_id}"
|
||||
|
||||
|
||||
docker_volume_size=$(docker run --rm -t -v ${docker_volume_id}:/volume_data ubuntu bash -c "du -hs /volume_data | cut -f1" )
|
||||
|
||||
echo " Size: ${docker_volume_size}"
|
||||
|
||||
|
||||
num_related_containers=$(docker ps -a --filter=volume=${docker_volume_id} -q | wc -l)
|
||||
|
||||
if (( $num_related_containers > 0 ))
|
||||
then
|
||||
echo " Connected containers:"
|
||||
docker ps -a --filter=volume=${docker_volume_id} --format "{{.Names}} ({{.Status}})" | while read containerDetails
|
||||
do
|
||||
echo " ${containerDetails}"
|
||||
done
|
||||
else
|
||||
echo " No connected containers"
|
||||
fi
|
||||
|
||||
echo
|
||||
done
|
Ładowanie…
Reference in New Issue