how to find MAX memory from docker stats?

后端 未结 4 1265
庸人自扰
庸人自扰 2021-02-18 15:26

With docker stats you can see the memory usage of a container over time.

Is there a way to find what the highest value of memory usage was while running

4条回答
  •  悲&欢浪女
    2021-02-18 15:55

    you can use command:

    docker stats --no-stream | awk '{ print $3 }' | sed '1d'|sort | tail -1
    

    It will give highest memory by container.

    Let me Explain command:

     --no-stream :          Disable streaming stats and only pull the first result
     awk '{ print $3 }' :   will print MEM USAGE
     sed '1d' :             will delete first entry that is %
     sort :                 it will sort the result
     tail -1 :              it will give last entry that is highest. 
    

提交回复
热议问题