Created
February 24, 2022 08:52
-
-
Save mysteriouss/d8b8bad7b36b06c24402d0a3f83c300d to your computer and use it in GitHub Desktop.
Revisions
-
mysteriouss created this gist
Feb 24, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/sh # grab the size and path to the largest overlay dir du /var/lib/docker/overlay2 -h | sort -h | tail -n 100 | grep -vE "overlay2$" > /tmp/large-overlay.txt # make sure json parser is installed # yum install -y jq # apt-get install jq -y # construct mappings of name to hash docker inspect $(docker ps -qa) | jq -r 'map([.Name, .GraphDriver.Data.MergedDir]) | .[] | "\(.[0])\t\(.[1])"' > /tmp/docker-mappings.txt # for each hashed path, find matching container name cat /tmp/large-overlay.txt | xargs -l bash -c 'if grep $1 /tmp/docker-mappings.txt; then echo -n "$0 "; fi'