From 4ea44797f55ef0914a72455497756ff2785fcee6 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 27 Feb 2023 14:17:52 +0100 Subject: [PATCH] only consider containers with config_hash labels (i.e, created by compose) Signed-off-by: Nicolas De Loof --- pkg/compose/ls.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/compose/ls.go b/pkg/compose/ls.go index f7094a321..25588f8d3 100644 --- a/pkg/compose/ls.go +++ b/pkg/compose/ls.go @@ -24,14 +24,14 @@ import ( "github.com/docker/compose/v2/pkg/api" "github.com/docker/compose/v2/pkg/utils" - moby "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/sirupsen/logrus" ) func (s *composeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) { list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{ - Filters: filters.NewArgs(hasProjectLabelFilter()), + Filters: filters.NewArgs(hasProjectLabelFilter(), hasConfigHashLabel()), All: opts.All, }) if err != nil { @@ -50,7 +50,8 @@ func containersToStacks(containers []moby.Container) ([]api.Stack, error) { for _, project := range keys { configFiles, err := combinedConfigFiles(containersByLabel[project]) if err != nil { - return nil, err + logrus.Warn(err.Error()) + configFiles = "N/A" } projects = append(projects, api.Stack{