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

Commit 13f37cf

Browse files
committed
fix detecting active profiles implied by selected services
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 7840be9 commit 13f37cf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cli/cmd/compose/compose.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
120120
return nil, metrics.WrapComposeError(err)
121121
}
122122

123-
s, err := project.GetServices(services...)
124-
if err != nil {
125-
return nil, err
123+
if len(services) > 0 {
124+
s, err := project.GetServices(services...)
125+
if err != nil {
126+
return nil, err
127+
}
128+
o.Profiles = append(o.Profiles, s.GetProfiles()...)
126129
}
127-
o.Profiles = append(o.Profiles, s.GetProfiles()...)
128130

129131
if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
130132
o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)

0 commit comments

Comments
 (0)