Skip to content

Instantly share code, notes, and snippets.

@OhadRubin
Last active April 5, 2024 17:35
Show Gist options
  • Save OhadRubin/9819f29ff124bade0ec9433cde1da5c7 to your computer and use it in GitHub Desktop.
Save OhadRubin/9819f29ff124bade0ec9433cde1da5c7 to your computer and use it in GitHub Desktop.
docker how much space
sudo ncdu /
sudo docker container ls -a --format '{{.ID}}:{{.Names}}' | xargs -I {} sh -c 'echo "Container {} ($(echo {} | cut -d: -f2)): $(sudo docker inspect --format "{{.GraphDriver.Data.MergedDir}}" $(echo {} | cut -d: -f1) | sed "s/\/merged$//") (Size: $(sudo du -sh $(sudo docker inspect --format "{{.GraphDriver.Data.MergedDir}}" $(echo {} | cut -d: -f1) | sed "s/\/merged$//") | cut -f1))"'
sudo docker image ls --format '{{.ID}}:{{.Repository}}:{{.Tag}}' | xargs -I {} sh -c 'echo "Image {} ($(echo {} | cut -d: -f2):$(echo {} | cut -d: -f3)): $(sudo docker inspect --format "{{.GraphDriver.Data.UpperDir}}" $(echo {} | cut -d: -f1) | sed "s/\/diff$//") (Size: $(sudo du -sh $(sudo docker inspect --format "{{.GraphDriver.Data.UpperDir}}" $(echo {} | cut -d: -f1) | sed "s/\/diff$//") | cut -f1))"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment