Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Add --services flag to compose ps #1321

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

aiordache
Copy link
Contributor

Add compose ps flag.

services:
  web:
    image: nginx
    ports:
      - 8080:80
  test1:
    image: nginx
    scale: 3
  test2:
    image: nginx

$ docker compose ps
NAME                  SERVICE             STATUS              PORTS
compose-cli_test1_1   test1               running             80/tcp
compose-cli_test1_2   test1               running             80/tcp
compose-cli_test1_3   test1               running             80/tcp
compose-cli_test2_1   test2               running             80/tcp
compose-cli_web_1     web                 running             0.0.0.0:8080->80/tcp

$ docker compose ps --services
test1
test2
web

Closes #1273

@github-actions github-actions bot added the cli cli label Feb 18, 2021
Copy link
Collaborator

@ndeloof ndeloof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
please avoid extra code duplication.
I hardly understand golang don't provide those in standard library :'(

@@ -102,3 +115,12 @@ func runPs(ctx context.Context, opts psOptions) error {
},
"NAME", "SERVICE", "STATUS", "PORTS")
}

func contains(slice []string, item string) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allready declared in ecs/context.go
as well as local/util.go
Those are just a few line, but many better to avoid more duplication
let's move those all into utils package, ok?

@ndeloof ndeloof merged commit 598f7bb into docker-archive:main Feb 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support compose ps --services
2 participants