Sort by memory usage in docker stats

前端 未结 4 1866
庸人自扰
庸人自扰 2020-12-31 02:12

Is there a way to display the docker stats sorted by memory usage of the containers?

I am using the following command to display the container with their names and I

4条回答
  •  醉酒成梦
    2020-12-31 03:02

    Make sure your locale's decimal seperator is a DOT. If it is different sorting won't work.

    That's why I use this command (Linux), note the LC_ALL=en_US.utf8:

    docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | LC_ALL=en_US.utf8 sort -k 4 -h
    

提交回复
热议问题