Last active
October 1, 2024 08:01
-
-
Save dmcallejo/ee3a903e329e4b59763ad45b812e3aba to your computer and use it in GitHub Desktop.
Docker internals cheatsheet
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
# Check logs size of containers, sorted by size and show total usage | |
sudo du -ch $(docker inspect --format='{{.LogPath}}' $(docker ps -qa)) | sort -h | sed 's/\/var\/lib\/docker\/containers\///' | awk '{if ($1 != "total") {split($NF, arr, "/"); id = arr[1]; print $1 " " $2 " " id} else {print $1 " " $2 " " $1}}' | while read size unit id; do if [ "$size" != "total" ]; then name=$(docker ps --format "{{.Names}}" --filter id=$id); echo "$size $unit $name"; else echo "$size $unit $id"; fi; done | |
# Check all volumes and images sizes | |
docker system df -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment