Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

docker ps <service> lists tasks for all services starting with service name <service> #77

Open
Deepak-Vohra opened this issue Jul 26, 2017 · 3 comments

Comments

@Deepak-Vohra
Copy link

Deepak-Vohra commented Jul 26, 2017

Expected behavior

Only tasks for a specific service be listed.

Actual behavior

Tasks for all services starting with the specified service name get listed.

Steps to reproduce the behavior

  1. ...Create two services (any arbitrary Docker services) with one with suffix -2. For example, two services mysql and mysql-2.
  2. ...The docker service ps mysql command lists tasks for both the services mysql and mysql-2.
~ $ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
likujs72e46t        mysql               replicated          3/3                 mysql:latest        
ocd9sz8qqp2b        mysql-2             replicated          3/3                 mysql:latest        
~ $ docker service ps mysql
ID                  NAME                IMAGE               NODE                            DESIRED STATE       CURRENT STATE            ERROR               PORTS
c2ckhyi0rmry        mysql-2.1           mysql:latest        ip-172-31-47-15.ec2.internal    Running             Running 11 minutes ago                       
v4bn24seygc6        mysql.1             mysql:latest        ip-172-31-47-15.ec2.internal    Running             Running 29 minutes ago                       
wnr3x7khz9vg        mysql-2.2           mysql:latest        ip-172-31-47-123.ec2.internal   Running             Running 7 minutes ago                        
29702ebj52gs        mysql.2             mysql:latest        ip-172-31-47-123.ec2.internal   Running             Running 27 minutes ago                       
f0112rfzt1cd        mysql-2.3           mysql:latest        ip-172-31-3-168.ec2.internal    Running             Running 7 minutes ago                        
c7b8v16msudl        mysql.3             mysql:latest        ip-172-31-3-168.ec2.internal    Running             Running 27 minutes ago         

@kencochrane
Copy link

This isn't docker for aws specific, probably best to add this issue to one of the upstream repos, maybe https://github.com/moby/moby is the right place?

It looks like docker service ps is using a wildcard search. There is probably a way to make it more rigid with it's results. For more info about docker service ps, including how to best to search and format the output, check out: https://docs.docker.com/engine/reference/commandline/service_ps/

@Deepak-Vohra
Copy link
Author

docker service ps is supposed to be for the specified service. Even enclosing service name in quotes docker service ps "mysql" lists all tasks for service name starting with "mysql"

@thaJeztah
Copy link
Member

Copying here as well; this is a duplicate of moby/moby#32556 and already fixed on master through docker/cli#72 (which will be included in docker 17.06.1)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants