Bläddra i källkod

fix detecting active profiles implied by selected services

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 4 år sedan
förälder
incheckning
13f37cf1c8
1 ändrade filer med 6 tillägg och 4 borttagningar
  1. 6 4
      cli/cmd/compose/compose.go

+ 6 - 4
cli/cmd/compose/compose.go

@@ -120,11 +120,13 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
 		return nil, metrics.WrapComposeError(err)
 	}
 
-	s, err := project.GetServices(services...)
-	if err != nil {
-		return nil, err
+	if len(services) > 0 {
+		s, err := project.GetServices(services...)
+		if err != nil {
+			return nil, err
+		}
+		o.Profiles = append(o.Profiles, s.GetProfiles()...)
 	}
-	o.Profiles = append(o.Profiles, s.GetProfiles()...)
 
 	if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
 		o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)