Skip to content

Commit

Permalink
Respect cli argument when checking docker backend availability (woodp…
Browse files Browse the repository at this point in the history
…ecker-ci#3770)

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
  • Loading branch information
2 people authored and 6543 committed Sep 5, 2024
1 parent ee2b09b commit fdbdae2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pipeline/backend/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fdbdae2

Please sign in to comment.