mirror of https://github.com/docker/compose.git
only consider containers with config_hash labels (i.e, created by compose)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
a99a0b50ef
commit
4ea44797f5
|
@ -24,14 +24,14 @@ import (
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
"github.com/docker/compose/v2/pkg/utils"
|
"github.com/docker/compose/v2/pkg/utils"
|
||||||
|
|
||||||
moby "github.com/docker/docker/api/types"
|
moby "github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) {
|
func (s *composeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) {
|
||||||
list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
||||||
Filters: filters.NewArgs(hasProjectLabelFilter()),
|
Filters: filters.NewArgs(hasProjectLabelFilter(), hasConfigHashLabel()),
|
||||||
All: opts.All,
|
All: opts.All,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -50,7 +50,8 @@ func containersToStacks(containers []moby.Container) ([]api.Stack, error) {
|
||||||
for _, project := range keys {
|
for _, project := range keys {
|
||||||
configFiles, err := combinedConfigFiles(containersByLabel[project])
|
configFiles, err := combinedConfigFiles(containersByLabel[project])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
logrus.Warn(err.Error())
|
||||||
|
configFiles = "N/A"
|
||||||
}
|
}
|
||||||
|
|
||||||
projects = append(projects, api.Stack{
|
projects = append(projects, api.Stack{
|
||||||
|
|
Loading…
Reference in New Issue