From 044c3a6dd5500ee5826962ddc1bccd28efa6b3dd Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:51:38 +0200 Subject: [PATCH] Respect cli argument when checking docker backend availability (#3770) Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> --- pipeline/backend/docker/docker.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pipeline/backend/docker/docker.go b/pipeline/backend/docker/docker.go index dc4cc287cc..7b7d313261 100644 --- a/pipeline/backend/docker/docker.go +++ b/pipeline/backend/docker/docker.go @@ -62,9 +62,11 @@ func (e *docker) Name() string { return "docker" } -func (e *docker) IsAvailable(context.Context) bool { - if os.Getenv("DOCKER_HOST") != "" { - return true +func (e *docker) IsAvailable(ctx context.Context) bool { + if c, ok := ctx.Value(backend.CliContext).(*cli.Context); ok { + if c.IsSet("backend-docker-host") { + return true + } } _, err := os.Stat("/var/run/docker.sock") return err == nil