Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created November 8, 2021 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayosec/0a4df059373cbe82ad093005e320c3ae to your computer and use it in GitHub Desktop.
Save ayosec/0a4df059373cbe82ad093005e320c3ae to your computer and use it in GitHub Desktop.
web_publica/spec/fixtures/images/rails.png
#!/bin/bash
#
# Compute disk usage for every Docker volume.
docker volume ls --filter driver=local --format '{{.Name}}\t{{.Mountpoint}}' \
| while IFS=$'\t' read -rs -a ITEM
do
name=${ITEM[0]}
path=${ITEM[1]}
if disk=$(du -xsh "$path" 2>&1)
then
printf '%s\t%s\n' "${disk/$'\t'*/}" "$name"
else
printf '?\t%s\n' "$name"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment