docker stats에서 Container Name 출력 :: 행복한 프로그래머

posted by 쁘로그램어 2018. 5. 30. 15:33

검색: docker stats container name


docker stats 명령은 기본적으로 Container ID만 출력된다.

Container Name을 확인하려면 아래와 같은 명령을 사용하면 된다.


# ID가 안나오고 NAME만 출력

$ docker stats $(docker inspect -f '{{.Name}}' $(docker ps -q) | cut -c 2-)

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


# ID, NAME 모두 출력

$ docker stats --format "table {{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"


※ 참고 사이트 ※

https://docs.docker.com/engine/reference/commandline/stats/#formatting

https://gist.github.com/SQiShER/5d8cd3f14e4c72c39456

https://stackoverflow.com/questions/30732313/is-there-any-way-to-display-container-names-in-docker-stats/42060599#42060599

'관심 기술 > docker' 카테고리의 다른 글

docker-compose란?  (0) 2018.07.10
container에서 python 로그 출력  (0) 2018.06.15
Docker Engine API 정리  (0) 2018.05.22
docker, Dockerfile cheat sheet  (0) 2018.05.17
cAdvisor REST API 테스트  (0) 2018.05.16