From c8b708a20b5f04d7b911f3bb1e8a25a132d81b77 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Tue, 9 Feb 2021 15:25:07 +0100 Subject: [PATCH] Fix orphans warning when running `docker compose up SERVICE` Signed-off-by: Guillaume Tardif --- local/compose/create.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/local/compose/create.go b/local/compose/create.go index 7e4f2af8..f436f8d2 100644 --- a/local/compose/create.go +++ b/local/compose/create.go @@ -73,7 +73,12 @@ func (s *composeService) Create(ctx context.Context, project *types.Project, opt return err } - orphans := observedState.filter(isNotService(project.ServiceNames()...)) + allServices := project.AllServices() + allServiceNames := []string{} + for _, service := range allServices { + allServiceNames = append(allServiceNames, service.Name) + } + orphans := observedState.filter(isNotService(allServiceNames...)) if len(orphans) > 0 { if opts.RemoveOrphans { w := progress.ContextWriter(ctx)