Compose: Filter does not restrict list (`docker-compose ps --filter publish=19088`)

Created on 26 Mar 2018  Â·  4Comments  Â·  Source: docker/compose

Description of the issue

I expect to only see containers that publish port 19088, but instead I see all containers started by my compose file.

$ docker-compose ps --filter "publish=19088" 
...
example_test_1                      /bin/sh -c /start.sh       Up           4444/tcp, 5900/tcp, 6080/tcp, 80/tcp          

Regular docker ps works as expected:

$ docker ps --filter "publish=19088" 
c35a214eabc1        192.168.1.61:5000/example:latest   "/tini -g -- /config…"   21 minutes ago      Up 21 minutes       9001/tcp, 0.0.0.0:5423->22/tcp, 0.0.0.0:5435->135/tcp, 0.0.0.0:5437->137/tcp, 0.0.0.0:5439->139/tcp, 0.0.0.0:5445->445/tcp, 0.0.0.0:5418->18088/tcp, 0.0.0.0:5419->19088/tcp   example_foo_1

Context information (for bug reports)

docker-compose version 1.20.0-rc2, build 8c4af54
Client:
 Version:   18.03.0-ce-rc4
 API version:   1.35 (downgraded from 1.37)
 Go version:    go1.9.4
 Git commit:    fbedb97
 Built: Thu Mar 15 07:33:28 2018
 OS/Arch:   darwin/amd64
 Experimental:  true
 Orchestrator:  swarm

Server:
 Engine:
  Version:  17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   7390fc6
  Built:    Tue Feb 27 22:16:13 2018
  OS/Arch:  linux/amd64
  Experimental: false
Output of "docker-compose config"
Really need this?

Steps to reproduce the issue

  1. Use compose to bring up services some that publish a port.
  2. Try to list those services.
  3. FYI I'm mainly needing this to list the containers for a service that were _not_ started by a run. I guess is-task=false should work too?

Observed result

see above

Expected result

see above

Stacktrace / full error message

no error, just not able to filter containers from compose

(if applicable)

Additional information

OS version / distribution, docker-compose install method, etc.

arecli kinenhancement stale

Most helpful comment

It should at least tell me that something is wrong. Also, there are many filters that would be usefil like "healthy"

All 4 comments

Hi @jamshid ,

As it stands, this is working as expected - the filter option is specific to Compose and only accepts filtering according to status or source (whether the container's image is built or pulled). It was primarily implemented to be used in completion (see #5384 )

That said, we should definitely document that better, and there's also an argument for supporting the engine's filtering as well (although it might have to be done through a different flag)

It should at least tell me that something is wrong. Also, there are many filters that would be usefil like "healthy"

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.

Was this page helpful?
0 / 5 - 0 ratings