feat(tools): docker autoinstall checks with docker info now and calls rootless setup helper after install
Some checks failed
Run Check Script / check (pull_request) Failing after 13m35s

This commit is contained in:
2026-01-19 16:48:38 -05:00
parent 50b3995449
commit dd6e36889b

View File

@@ -87,28 +87,27 @@ impl Docker {
PathBuf::from("docker") PathBuf::from("docker")
} }
/// Checks if docker is installed and available in the PATH /// Checks if Docker is installed and the daemon is responsive.
pub fn is_installed(&self) -> bool { pub fn is_installed(&self) -> bool {
let bin_path = self.get_bin_path(); trace!("Checking if Docker is installed and responsive");
trace!("Checking if Docker is installed at: {:?}", bin_path);
std::process::Command::new(&bin_path) self.command()
.arg("--version") .arg("info")
.output() .output()
.map(|output| { .map(|output| {
if output.status.success() { if output.status.success() {
trace!("Docker version check successful"); trace!("Docker daemon is responsive");
true true
} else { } else {
trace!( trace!(
"Docker version check failed with status: {:?}", "Docker daemon check failed with status: {:?}",
output.status output.status
); );
false false
} }
}) })
.map_err(|e| { .map_err(|e| {
trace!("Failed to execute Docker version check: {}", e); trace!("Failed to execute Docker daemon check: {}", e);
e e
}) })
.unwrap_or(false) .unwrap_or(false)
@@ -183,6 +182,32 @@ impl Docker {
if status.success() { if status.success() {
info!("{} installed successfully", variant); info!("{} installed successfully", variant);
if variant == DockerVariant::Rootless { if variant == DockerVariant::Rootless {
info!("Running rootless setup tool to install dependencies and start service...");
let mut setup_cmd = std::process::Command::new("sh");
// Set PATH to include ~/bin where the script was likely installed
if let Ok(home) = std::env::var("HOME") {
let bin_path = format!("{}/bin", home);
if let Ok(current_path) = std::env::var("PATH") {
setup_cmd.env("PATH", format!("{}:{}", bin_path, current_path));
}
setup_cmd.arg(format!("{}/bin/dockerd-rootless-setuptool.sh", home));
} else {
setup_cmd.arg("dockerd-rootless-setuptool.sh");
}
setup_cmd.arg("install");
debug!("Executing rootless setup command: {:?}", setup_cmd);
let setup_status = setup_cmd.status().map_err(|e| {
error!("Failed to execute rootless setup tool: {}", e);
format!("Failed to execute rootless setup tool: {}", e)
})?;
if !setup_status.success() {
warn!("Rootless setup tool finished with non-zero exit code. You may need to install 'uidmap' or start the service manually.");
}
warn!("Please follow the instructions above to finish rootless setup (environment variables)."); warn!("Please follow the instructions above to finish rootless setup (environment variables).");
} }
@@ -192,9 +217,10 @@ impl Docker {
Ok(()) Ok(())
} else { } else {
error!( error!(
"{} installation script failed with exit code: {:?}", "{} installation script failed with exit code: {:?} \n\nOutput:\n{:?}",
variant, variant,
status.code() status.code(),
cmd.output(),
); );
Err(format!("{} installation script failed", variant)) Err(format!("{} installation script failed", variant))
} }