Print docker container men usage
.
docker stats --no-stream --format "table {{.Container}}\t{{.MemUsage}}"
CONTAINER MEM USAGE / LIMIT
df1db3352f5c 62.85MiB / 7.581GiB
e225c0866cef 778.8MiB / 7.581GiB
8e40a961b59d 1.121GiB / 7.581GiB
f66e33681593 173MiB / 7.581GiB
..
Print image size
.
docker ps --format '{{.Image}}' | uniq | xargs -I {} docker image ls --format "table {{.Repository}}\t{{.Size}}" {}
REPOSITORY SIZE
5978.com/fast-api 643MB
REPOSITORY SIZE
5978.com/recognition 2.52GB
REPOSITORY SIZE
5978.com/detector 746MB
..
.
All together
#!/bin/bash
echo "Memory Usage of Running Containers:"
docker stats --no-stream --format "table {{.Container}}\t{{.MemUsage}}"
echo ""
echo "Image Size of Running Containers:"
docker ps --format '{{.Image}}' | uniq | xargs -I {} docker image ls --format "table {{.Repository}}\t{{.Size}}" {}
..
Thank you.
www.marearts.com
๐๐ป♂️
No comments:
Post a Comment