Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: docker compose ps #5

Open
TKperson opened this issue Jul 7, 2023 · 5 comments
Open

Feature: docker compose ps #5

TKperson opened this issue Jul 7, 2023 · 5 comments
Labels
enhancement New feature or request PR welcome Won't do it myself, but you can send a PR

Comments

@TKperson
Copy link

TKperson commented Jul 7, 2023

A lot of times, docker compose ps looks as worse as docker ps. Can you make this program work with docker compose ps too?

Adding --compose flag and have that aliased to docker compose ps in the shell configuration files should be sufficient.

@Mikescher
Copy link
Owner

Hmm, is their a relatively easy way to get the data of docker compose ps ?
I'm not executing the docker binary under the hood, but query the data directly via the docket socket [1].

I guess I could add a filter on the label com.docker.compose.project, but then the user would have to manually insert the project name.
I definitely don't want to add parsing code for the dockercompose.yml, this is a relatively small and simple project and should stay that way.

But if anyone want to add a filter docker-compose filter (aka only show container with this specific project label), I guess that could be in-scope.
If you want you can create a PR and I'll look at it.

[1] https://docs.docker.com/registry/spec/api/

@Mikescher Mikescher added enhancement New feature or request PR welcome Won't do it myself, but you can send a PR labels Jul 9, 2023
@TKperson
Copy link
Author

TKperson commented Jul 9, 2023

Wouldn't reading the output directly from docker compose ps be enough?

@Mikescher
Copy link
Owner

Wouldn't reading the output directly from docker compose ps be enough?

No, either I would:

  • simple directly print the docker compose ps output (but then what's the point)
  • parse the docker compose output (ugh, thats not really a good or stable format to parse)

also I display potentially more data than the default docker compose ps output prints (networks, labels, etc)

@quinn
Copy link

quinn commented Aug 16, 2024

You can do this with regular docker ps like this:

docker ps --filter "label=com.docker.compose.project=$PROJECT_NAME"

the filter flag here doesn't seem to work exactly the same?

this command:

dops --filter "label=com.docker.compose.project=$PROJECT_NAME"

seems to return all the containers. I think supporting the label filter would be sufficient to fix this?

@quinn
Copy link

quinn commented Aug 16, 2024

Looking thru your code, it looks like you just handoff the filter to the docker API. Not sure why this isn't working, maybe docker ps does something special to handle the label filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR welcome Won't do it myself, but you can send a PR
Projects
None yet
Development

No branches or pull requests

3 participants