Skip to content

Commit

Permalink
fix(docker): don't early exit if docker binary isn't available (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva authored May 14, 2024
1 parent e5cb153 commit cd5c765
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions crates/provider/src/docker/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,24 @@ impl DockerClient {
}

async fn is_using_podman() -> Result<bool> {
let result = tokio::process::Command::new("docker")
if let Ok(output) = tokio::process::Command::new("docker")
.arg("version")
.output()
.await
{
// detect whether we're actually running podman with docker emulation
return Ok(String::from_utf8_lossy(&output.stdout)
.to_lowercase()
.contains("podman"));
}

tokio::process::Command::new("podman")
.arg("--version")
.output()
.await
.map_err(|err| anyhow!("Failed to detect container engine: {err}"))?;

if !result.status.success() {
return Err(anyhow!(
"Failed to detect container engine: {}",
String::from_utf8_lossy(&result.stderr)
)
.into());
}

Ok(String::from_utf8_lossy(&result.stdout).contains("podman"))
Ok(true)
}
}

Expand Down

0 comments on commit cd5c765

Please sign in to comment.