Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condense output of docker compose top #12381

Open
dmke opened this issue Dec 13, 2024 · 0 comments
Open

Condense output of docker compose top #12381

dmke opened this issue Dec 13, 2024 · 0 comments

Comments

@dmke
Copy link

dmke commented Dec 13, 2024

Description

In a current compose project, docker compose top reports the following:

$ docker compose top
myproject-converters-1
UID    PID      PPID     C    STIME   TTY   TIME       CMD
root   336052   335954   0    11:18   ?     00:00:01   ruby bin/server

myproject-redis-ephemeral-1
UID        PID      PPID     C    STIME   TTY   TIME       CMD
systemd+   336001   335887   0    11:18   ?     00:00:05   valkey-server *:6379

myproject-redis-persisted-1
UID    PID      PPID     C    STIME   TTY   TIME       CMD
root   336038   335921   0    11:18   ?     00:00:08   valkey-server *:6379

myproject-sidekiq-default-1
UID      PID      PPID     C    STIME   TTY   TIME       CMD
appuser   338516   338496   19   12:00   ?     00:00:09   sidekiq 7.3.6 default [0 of 3 busy]

myproject-watchtower-1
UID    PID      PPID     C    STIME   TTY   TIME       CMD
root   335931   335850   0    11:18   ?     00:00:00   /watchtower --label-enable --include-stopped --revive-stopped --cleanup --rolling-restart --stop-timeout=80s --http-api-update

myproject-web-1
UID      PID      PPID     C    STIME   TTY   TIME       CMD
appuser   338619   338597   0    12:00   ?     00:00:00   /bin/bash -e /rails/bin/docker-entrypoint.sh rails server
appuser   338653   338619   0    12:00   ?     00:00:00   flock -x /rails/data/migration-check.lock bundle exec rake db:prepare
appuser   338665   338653   46   12:00   ?     00:00:01   /usr/local/bundle/ruby/3.2.0/bin/rake db:prepare

I find this a bit wasteful, in regards to the screen estate. The output is also hard to grasp because the columns are not aligned across the various services.

Would you accept a PR to format the output to something like the following?

$ docker compose top
SERVICE                       UID        PID      PPID     C    STIME   TTY   TIME       CMD
myproject-converters-1        root       336052   335954   0    11:18   ?     00:00:01   ruby bin/server
myproject-redis-ephemeral-1   systemd+   336001   335887   0    11:18   ?     00:00:05   valkey-server *:6379
myproject-redis-persisted-1   root       336038   335921   0    11:18   ?     00:00:08   valkey-server *:6379
myproject-sidekiq-default-1   appuser    338516   338496   19   12:00   ?     00:00:09   sidekiq 7.3.6 default [0 of 3 busy]
myproject-watchtower-1        root       335931   335850   0    11:18   ?     00:00:00   /watchtower --label-enable --include-stopped --revive-stopped --cleanup --rolling-restart --stop-timeout=80s --http-api-update
myproject-web-1               appuser    338619   338597   0    12:00   ?     00:00:00   /bin/bash -e /rails/bin/docker-entrypoint.sh rails server
myproject-web-1               appuser    338653   338619   0    12:00   ?     00:00:00   flock -x /rails/data/migration-check.lock bundle exec rake db:prepare
myproject-web-1               appuser    338665   338653   46   12:00   ?     00:00:01   /usr/local/bundle/ruby/3.2.0/bin/rake db:prepare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant