From 7369127650b977753536b70544af28873a13ed88 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Thu, 1 Dec 2022 09:37:45 +0100 Subject: [PATCH] use StringToBool to detect COMPOSE_IGNORE_ORPHANS Signed-off-by: Nicolas De Loof --- cmd/compose/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/compose/run.go b/cmd/compose/run.go index f2611cd6e0..f1e1f0a36d 100644 --- a/cmd/compose/run.go +++ b/cmd/compose/run.go @@ -32,6 +32,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/compose/v2/pkg/api" "github.com/docker/compose/v2/pkg/progress" + "github.com/docker/compose/v2/pkg/utils" ) type runOptions struct { @@ -140,8 +141,7 @@ func runCommand(p *projectOptions, dockerCli command.Cli, backend api.Service) * if err != nil { return err } - ignore := project.Environment["COMPOSE_IGNORE_ORPHANS"] - opts.ignoreOrphans = strings.ToLower(ignore) == "true" + opts.ignoreOrphans = utils.StringToBool(project.Environment["COMPOSE_IGNORE_ORPHANS"]) return runRun(ctx, backend, project, opts, createOpts) }), ValidArgsFunction: completeServiceNames(p),