瀏覽代碼

Merge pull request #1987 from ndeloof/ignore_oneoff_events

ignore one-off container events
Mathieu Champlon 4 年之前
父節點
當前提交
9030f5a66b
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      pkg/compose/events.go

+ 7 - 1
pkg/compose/events.go

@@ -21,10 +21,11 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/compose-cli/pkg/api"
 	moby "github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 
+	"github.com/docker/compose-cli/pkg/api"
+
 	"github.com/docker/compose-cli/pkg/utils"
 )
 
@@ -40,6 +41,11 @@ func (s *composeService) Events(ctx context.Context, project string, options api
 				continue
 			}
 
+			oneOff := event.Actor.Attributes[api.OneoffLabel]
+			if oneOff == "True" {
+				// ignore
+				continue
+			}
 			service := event.Actor.Attributes[api.ServiceLabel]
 			if len(options.Services) > 0 && !utils.StringContains(options.Services, service) {
 				continue