计算Bash中Docker容器使用的总内存[英]Compute the total memory used by Docker containers in Bash

How to compute in one Bash command line the total memory used by Docker containers running on the local Docker engine?

如何在一个Bash命令行中计算在本地Docker引擎上运行的Docker容器使用的总内存?

1 个解决方案
#1
0  

I use the following command to compute the total memory used in MB.

我使用以下命令计算以MB为单位的总内存。

docker stats --no-stream --format 'table {{.MemUsage}}' | sed 's/[A-Za-z]*//g' | awk '{sum += $1} END {print sum "MB"}'

猜你喜欢

转载自blog.csdn.net/weixin_44019542/article/details/84965261