bashtop icon indicating copy to clipboard operation
bashtop copied to clipboard

[REQUEST] Docker container stats

Open Memphizzz opened this issue 5 years ago • 6 comments

Is your feature request related to a problem? Please describe. It would be great if bashtop could also display docker containers and their cpu/mem usage or even better combined stats for all containers. Turning this on/off via config or parameters would be nice to save space if the machine does not run docker containers.

Describe the solution you'd like See docker container overview cpu and memory usage to not have to split a tmux pane and reduce the full screen height

Describe alternatives you've considered None.

Additional context This is the best htop/gotop replacement out there.

Memphizzz avatar May 04 '20 05:05 Memphizzz

Sure, it's doable. But will not be high priority on the todo's unless a lot of people want this.

aristocratos avatar May 05 '20 10:05 aristocratos

That's not a bad idea, docker stats can be used to gather container stats, also with options to show all or only running containers, also filter witch containers to show.
However docker requires permissions to run as user.

bcicen/ctop can be used as example

Generator avatar May 05 '20 20:05 Generator

Looks like it could be more difficult then i thought. docker stats --no-stream has a quite a delay since it samples when running so would be a very slow way to poll data and would essentially halt any keyboard input for 1 second at the lowest end. Could maybe run it in background if no other options is available, but would lag behind realtime statistics. ctop looks to be strictly interactive so no data polling possible. docker ps shows no cpu or mem usage.

We need a better way to poll cpu and mem usage for running containers.

aristocratos avatar May 06 '20 14:05 aristocratos

However docker requires permissions to run as user.

Yeah would require bashtop to be run with sudo or as root.

aristocratos avatar May 06 '20 14:05 aristocratos

take a look at lazydocker. something similar showing a list of running containers might be nice.

seanvaleo avatar Sep 15 '21 20:09 seanvaleo

You can use the Docker API to connect directly to the service with https://docs.docker.com/engine/api/v1.41/#operation/ContainerStats

BellemareMederic avatar Oct 25 '21 01:10 BellemareMederic