Skip to content

Add ps -s option to print service names. - #1077

Closed
tpounds wants to merge 5 commits into
docker:masterfrom
tpounds:add_ps_-s_option
Closed

tpounds wants to merge 5 commits into
docker:masterfrom
tpounds:add_ps_-s_option

Conversation

@tpounds

@tpounds tpounds commented Mar 6, 2015

Copy link
Copy Markdown

A new -s option to support printing names in addition to images. Useful in scripting scenarios since compose uses service names natively for most commands.

@tpounds tpounds changed the title Add ps command option to print service names. Add ps -s option to print service names. Mar 6, 2015
@albers

albers commented Mar 13, 2015

Copy link
Copy Markdown

👍
This should also be added to bash completion here.

@tpounds

tpounds commented Mar 14, 2015

Copy link
Copy Markdown
Author

Updated with bash completion support. Thanks @albers!

@albers

albers commented Mar 14, 2015

Copy link
Copy Markdown

Completion LGTM. Thanks!

@dnephin

dnephin commented May 31, 2015

Copy link
Copy Markdown

LGTM

@aanand

aanand commented Jun 1, 2015

Copy link
Copy Markdown

Could you add it to zsh as well, now that we've merged #1325?

@aanand

aanand commented Jun 1, 2015

Copy link
Copy Markdown

(Also, could ps -s be used by the completion scripts instead of hacky manual YAML file parsing?)

@albers

albers commented Jun 1, 2015

Copy link
Copy Markdown

@aanand Sadly, ps -s won't help here as it only lists existing containers. For completion, I also need the names of services without existing containers. I do not know of any other way to get the full service list other than parsing the yaml.

What I really miss here is some kind of ps -a -s that lists services regardless of container creation state.

@tpounds

tpounds commented Jun 2, 2015

Copy link
Copy Markdown
Author

@aanand Updated with zsh completion. I'm going to leave the YAML parsing as-is for now per @albers feedback. LMK if I should address anything else.

@albers

albers commented Jun 2, 2015

Copy link
Copy Markdown

@aanand @tpounds What do you think of an -a option that is only valid when -s is given that makes compose output the full list of services?
The new -s option is nice, but as it only cares for services with existing instances, it only covers a subset of scripting scenarios. See my above mentioned usecase in bash completion: extractig the full service list.

@aanand

aanand commented Jun 2, 2015

Copy link
Copy Markdown

I've put some thoughts down in #1498 - let's move the discussion there.

@dnephin

dnephin commented Jun 2, 2015

Copy link
Copy Markdown

LGTM

@aanand

aanand commented Jun 2, 2015

Copy link
Copy Markdown

Thinking about it, since this overlaps with the requirements laid out in #1498, I retract my LGTM - we should figure out the best way to serve all these needs, which might involve an entirely new command.

@tpounds

tpounds commented Jun 2, 2015

Copy link
Copy Markdown
Author

@aanand @albers I agree a more general command as mentioned in #1498 would be useful for many scenarios. Do you think there is any value in providing the context aware options to docker-compose ps in addition to a new command as well? My thought is something consistent with what docker ps provides.

@aanand

aanand commented Jun 2, 2015

Copy link
Copy Markdown

@tpounds It could be useful to support more of docker ps' options in docker-compose ps, but I don't think they would share any code.

For example:

  • docker-compose services --filter as discussed in Make shell completion DRYer and less hacky #1498 would be filtering services and doing it client-side by looking at the YAML file and what's running.
  • docker ps --filter just passes filters for containers along to the Docker API, which will filter them server-side.

@dnephin

dnephin commented Aug 7, 2015

Copy link
Copy Markdown

I think there is value in this as-is (use case #374 (comment)).

@dnephin

dnephin commented Sep 1, 2015

Copy link
Copy Markdown

I think the proposal in #1953 might be more appropriate for this feature. ps is the status of containers, so just displaying service names doesn't fit all that well.

@dnephin

dnephin commented Oct 6, 2015

Copy link
Copy Markdown

Thanks for the contribution!

Sorry it's taken us a while to respond. We'd like to support this feature with the docker-compose config command proposal in #1953.

@dnephin dnephin closed this Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants