瀏覽代碼

Fix orphans warning when running `docker compose up SERVICE`

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 4 年之前
父節點
當前提交
c8b708a20b
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      local/compose/create.go

+ 6 - 1
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)