compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose ps enhancements

Open dnephin opened this issue 11 years ago • 7 comments

This issue is to aggregate all the requests for enhancements to ps.

  • include the swarm node name (#2366)
  • some way to disable wrapping of lines, either with a flag, or default to no wrapping when the terminal is not a tty (#1414)
  • machine readable output, as json (#1992)
  • container ip address (#1038)
  • include the short container id (#1414)
  • support additional fields (#1414)

We need to find a way to support all of this without making the default unnecessarily verbose. I think we should be keeping the default fairly close to what we have now.

One option is to add a bunch of flags to include new columns.

dnephin avatar Nov 11 '15 18:11 dnephin

Hello,

Thanks to gather the PRs and issues around PS. I think the default should be as it is, but give an oportunity the user to customize the columns would be great. E.g.: docker ps:

Name Command State Ports

dockermaster_etcd_1 /etcd Up 0.0.0.0:2379->2379/tcp, 2380/tcp, 4001/tcp, 7001/tcp dockermaster_etcd_2 /etcd Up 0.0.0.0:2380->2379/tcp, 2380/tcp, 4001/tcp, 7001/tcp

docker ps --columns name dockermaster_etcd_1 dockermaster_etcd_2

And docker ps --help should show the available columns. And ps shouldn't rely on tty at all IMHO, cause for example when user process the output from script there's no such a thing like tty. The "machine readable output, as json" would be also great. With --json should drop the ps output like a simple json array as you suggested the original PR.

lmesz avatar Nov 13 '15 17:11 lmesz

I wanted to bring up another notice. Currently ps returns container name as a first column

# docker-compose ps
     Name                    Command                State     Ports 
-------------------------------------------------------------------
fusion114_cli_1   /opt/startup.sh /bin/sh -c ...   Exit 137         
fusion114_db_1    /entrypoint.sh mysqld            Exit 128         
fusion114_web_1   /opt/startup.sh apache2 -D ...   Exit 0   

However that value is useless for any other docker-compose command as docker-compose can not work with container names but only works with services.

# docker-compose ps fusion114_cli_1
No such service: fusion114_cli_1
# docker-compose ps cli
     Name                    Command                State     Ports 
-------------------------------------------------------------------
fusion114_cli_1   /opt/startup.sh /bin/sh -c ...   Exit 137   

It makes sense to drop Name column and introduce Service Name or Service column instead.

# docker-compose ps
Service                    Command                State     Ports 
-------------------------------------------------------------------
cli         /opt/startup.sh /bin/sh -c ...   Exit 137         
db          /entrypoint.sh mysqld            Exit 128         
web         /opt/startup.sh apache2 -D ...   Exit 0   

achekulaev avatar Feb 12 '16 21:02 achekulaev

especially a docker-compose --columns "name, state" will be very intresting for me. I'm running some containers that have a lot of ports (hardware/mailserver for example) and I just want to check if everything is up but it's hard to follow the lines when some containers have more than one line..

tflori avatar Feb 28 '17 09:02 tflori

Feature parity, and output format parity, across docker ps and docker-compose ps would be very nice.

E.g.:

  • docker ps supports filtering (with the -f/-filter option), while docker-compose ps does not
  • docker ps supports formatting (with the --format option), while docker-compose ps does not
  • docker-ps just returns one line with column names and then the info, while docker-compose ps includes a horizontal line in the output
  • etc.

znerd avatar Jun 22 '18 13:06 znerd

@achekulaev Only if you want to docker cp you'll need the container name.

reitzig avatar Sep 03 '19 14:09 reitzig

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 17 '22 15:04 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Apr 25 '22 05:04 stale[bot]