浏览代码

fix(down): Fix down command if specified services are not running

Signed-off-by: Suleiman Dibirov <[email protected]>
Suleiman Dibirov 1 年之前
父节点
当前提交
abcc91e2b9
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      pkg/compose/down.go

+ 8 - 1
pkg/compose/down.go

@@ -67,11 +67,18 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
 	}
 
 	// Check requested services exists in model
-	options.Services, err = checkSelectedServices(options, project)
+	services, err := checkSelectedServices(options, project)
 	if err != nil {
 		return err
 	}
 
+	if len(options.Services) > 0 && len(services) == 0 {
+		logrus.Infof("Any of the services %v not running in project %q", options.Services, projectName)
+		return nil
+	}
+
+	options.Services = services
+
 	if len(containers) > 0 {
 		resourceToRemove = true
 	}