Skip to content

Commit 4ea4479

Browse files
committed
only consider containers with config_hash labels (i.e, created by compose)
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent a99a0b5 commit 4ea4479

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/compose/ls.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import (
2424

2525
"github.com/docker/compose/v2/pkg/api"
2626
"github.com/docker/compose/v2/pkg/utils"
27-
2827
moby "github.com/docker/docker/api/types"
2928
"github.com/docker/docker/api/types/filters"
29+
"github.com/sirupsen/logrus"
3030
)
3131

3232
func (s *composeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) {
3333
list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
34-
Filters: filters.NewArgs(hasProjectLabelFilter()),
34+
Filters: filters.NewArgs(hasProjectLabelFilter(), hasConfigHashLabel()),
3535
All: opts.All,
3636
})
3737
if err != nil {
@@ -50,7 +50,8 @@ func containersToStacks(containers []moby.Container) ([]api.Stack, error) {
5050
for _, project := range keys {
5151
configFiles, err := combinedConfigFiles(containersByLabel[project])
5252
if err != nil {
53-
return nil, err
53+
logrus.Warn(err.Error())
54+
configFiles = "N/A"
5455
}
5556

5657
projects = append(projects, api.Stack{

0 commit comments

Comments
 (0)