From 377bcd80489c84ac5c5ae07f8dc5b511fdf70ab2 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 17 May 2021 11:00:00 +0200 Subject: [PATCH] only start current project services Signed-off-by: Nicolas De Loof --- cli/cmd/compose/up.go | 4 +++- local/compose/attach.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/cmd/compose/up.go b/cli/cmd/compose/up.go index 6c926fdbf..b7a4b125b 100644 --- a/cli/cmd/compose/up.go +++ b/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 }) diff --git a/local/compose/attach.go b/local/compose/attach.go index 5250204e5..ddef6eb40 100644 --- a/local/compose/attach.go +++ b/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