docker-compose ps enhancements
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.
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.
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
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..
Feature parity, and output format parity, across docker ps and docker-compose ps would be very nice.
E.g.:
docker pssupports filtering (with the-f/-filteroption), whiledocker-compose psdoes notdocker pssupports formatting (with the--formatoption), whiledocker-compose psdoes notdocker-psjust returns one line with column names and then the info, whiledocker-compose psincludes a horizontal line in the output- etc.
@achekulaev Only if you want to docker cp you'll need the container name.
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.
This issue has been automatically closed because it had not recent activity during the stale period.