Skip to main content

Docker Resource Stats

docker stats

docker stats --no-stream --format json > ~/stats.json
cat ~/stats.json | jq -r '.Name + "\t" + (.MemUsage|split("/")|.[0])' | awk '{ if(index($2, "GiB")) {gsub("GiB","",$2); $2=$2*1000 } else {gsub("MiB","",$2)}; sum += $2; print $0,"MiB"} END {print "TOTAL",sum/1024,"GiB"}' | sort -nk2 | tee stats.tsv

docker top

docker top

htop

htop -s PERCENT_MEM