Pārlūkot izejas kodu

Merge pull request #1680 from ndeloof/start_services

only start current project services
Nicolas De loof 4 gadi atpakaļ
vecāks
revīzija
ba4c7858c9
2 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 3 1
      cli/cmd/compose/up.go
  2. 4 0
      local/compose/attach.go

+ 3 - 1
cli/cmd/compose/up.go

@@ -254,7 +254,9 @@ func runCreateStart(ctx context.Context, backend compose.Service, opts upOptions
 			return "", err
 		}
 		if opts.Detach {
-			err = backend.Start(ctx, project, compose.StartOptions{})
+			err = backend.Start(ctx, project, compose.StartOptions{
+				Services: services,
+			})
 		}
 		return "", err
 	})

+ 4 - 0
local/compose/attach.go

@@ -33,6 +33,10 @@ import (
 )
 
 func (s *composeService) attach(ctx context.Context, project *types.Project, listener compose.ContainerEventListener, selectedServices []string) (Containers, error) {
+	if len(selectedServices) == 0 {
+		selectedServices = project.ServiceNames()
+	}
+
 	containers, err := s.getContainers(ctx, project.Name, oneOffExclude, true, selectedServices...)
 	if err != nil {
 		return nil, err