Is there any way to display container names in docker stats?

后端 未结 4 583
滥情空心
滥情空心 2021-01-31 14:27

I want to display state of all running container, so I could achieve it like the following:

docker stats $(docker ps -q)

CON         


        
4条回答
  •  灰色年华
    2021-01-31 15:26

    Or, using plain "docker ps" instead of "awk"... note "--format" is normally used with "docker inspect":

    docker stats $(docker ps --format '{{.Names}}')
    

    2017-02-12 See manat's answer below (https://stackoverflow.com/a/42060599/72717). Docker 1.13.0 "stats" can display the container name in "--format":

    docker stats --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
    

提交回复
热议问题