Skip to main content

anza_xtask/utils/
docker.rs

1use {anyhow::Result, std::process::Command};
2
3pub fn check_docker_available() -> Result<()> {
4    let output = Command::new("docker")
5        .args(["--version"])
6        .output()
7        .map_err(|e| anyhow::anyhow!("Failed to run docker command: {e}"))?;
8
9    if !output.status.success() {
10        return Err(anyhow::anyhow!(
11            "Failed to run docker command: {}",
12            String::from_utf8_lossy(&output.stderr)
13        ));
14    }
15    Ok(())
16}