Merge pull request #10035 from ndeloof/9323

use StringToBool to detect COMPOSE_IGNORE_ORPHANS
This commit is contained in:
Guillaume Lours 2022-12-01 10:06:21 +01:00 committed by GitHub
commit 7cf5940f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import (
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
"github.com/docker/compose/v2/pkg/api" "github.com/docker/compose/v2/pkg/api"
"github.com/docker/compose/v2/pkg/progress" "github.com/docker/compose/v2/pkg/progress"
"github.com/docker/compose/v2/pkg/utils"
) )
type runOptions struct { type runOptions struct {
@ -140,8 +141,7 @@ func runCommand(p *projectOptions, dockerCli command.Cli, backend api.Service) *
if err != nil { if err != nil {
return err return err
} }
ignore := project.Environment["COMPOSE_IGNORE_ORPHANS"] opts.ignoreOrphans = utils.StringToBool(project.Environment["COMPOSE_IGNORE_ORPHANS"])
opts.ignoreOrphans = strings.ToLower(ignore) == "true"
return runRun(ctx, backend, project, opts, createOpts) return runRun(ctx, backend, project, opts, createOpts)
}), }),
ValidArgsFunction: completeServiceNames(p), ValidArgsFunction: completeServiceNames(p),