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

后端 未结 4 610
滥情空心
滥情空心 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:14

    A bit hacky, but works:

    docker stats $(docker ps | tail -n +2 | awk '{print $NF}')

    tail -n +2 is there to remove docker ps header line, and finally awk '{print $NF}' prints the last column (i.e. container name) for every input line

提交回复
热议问题