Compose: Feature Request: docker-compose stats

Created on 26 Mar 2015  路  22Comments  路  Source: docker/compose

Is it too much cross over/out of scope to implement the stats option in compose

docker-compose stats service_name --index=n

??

kinfeature

Most helpful comment

I see issues being closed as being duplicates of this one, yet no progress seem to have been made so far. It has been since like 2015, wow.

I feel like docker-compose stats should essentially do this:

docker-compose ps -q | xargs docker stats

All 22 comments

Nice idea, perhaps even docker-compose stats to show stats of all containers of the project.

Not sure if Docker allready supports filtering (ie, specifying a _list_ of containers to get stats for). I'll check, otherwise will create a feature request upstream.

Checked; the stats API actually is _per container_, so that should be possible, by making an API call for each container.

Would be nice though, if docker offered an endpoint to achieve that (e.g. GET /stats?filter=....)

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1
until thats implemented Im creating an alias to docker stats with the name in the format

docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"
docker stats $(docker ps --format={{.Names}} --filter "label=com.docker.compose.project=PROJECT-NAME")

+1

+1

+1

+1

docker stats $(docker-compose ps -q || echo "#")
docker ps $((docker-compose ps -q  || echo "#") | while read line; do echo "--filter id=$line"; done)
# ~/.bashrc
...
alias dc='docker-compose'
alias dcs='docker stats $(docker-compose ps -q || echo "#")'
alias dcps='docker ps $((docker-compose ps -q  || echo "#") | while read line; do echo "--filter id=$line"; done)'

I see issues being closed as being duplicates of this one, yet no progress seem to have been made so far. It has been since like 2015, wow.

I feel like docker-compose stats should essentially do this:

docker-compose ps -q | xargs docker stats

Is it possible?

Was this page helpful?
0 / 5 - 0 ratings