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

Commit 59efedf

Browse files
authored
Merge pull request #1649 from ndeloof/ps_all
2 parents f1aaab1 + f408461 commit 59efedf

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

local/compose/ps.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ import (
2626
)
2727

2828
func (s *composeService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
29-
containers, err := s.getContainers(ctx, projectName, oneOffInclude, options.All, options.Services...)
29+
oneOff := oneOffExclude
30+
if options.All {
31+
oneOff = oneOffInclude
32+
}
33+
containers, err := s.getContainers(ctx, projectName, oneOff, true, options.Services...)
3034
if err != nil {
3135
return nil, err
3236
}

local/compose/ps_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ func TestPs(t *testing.T) {
3737
tested.apiClient = api
3838

3939
ctx := context.Background()
40-
listOpts := apitypes.ContainerListOptions{Filters: filters.NewArgs(projectFilter(testProject)), All: false}
40+
args := filters.NewArgs(projectFilter(testProject))
41+
args.Add("label", "com.docker.compose.oneoff=False")
42+
listOpts := apitypes.ContainerListOptions{Filters: args, All: true}
4143
c1, inspect1 := containerDetails("service1", "123", "Running", "healthy")
4244
c2, inspect2 := containerDetails("service1", "456", "Running", "")
4345
c2.Ports = []apitypes.Port{{PublicPort: 80, PrivatePort: 90, IP: "localhost"}}

0 commit comments

Comments
 (0)