Skip to content

Commit

Permalink
Respect cli argument when checking docker backend availability (#3770)
Browse files Browse the repository at this point in the history
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
  • Loading branch information
qwerty287 and anbraten committed Jun 10, 2024
1 parent 1953a0e commit 044c3a6
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 044c3a6

Please sign in to comment.