From 56ff01d0b5ba2c76c4036b8a1a99ff499e190a76 Mon Sep 17 00:00:00 2001 From: Thiago Riemma Carbonera Date: Fri, 10 Jul 2026 11:57:03 -0300 Subject: [PATCH] fix: automatic fallback to podman socket in docker_environments --- docs/notes/2.34.x.md | 2 ++ .../process_execution/docker/src/docker.rs | 25 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/notes/2.34.x.md b/docs/notes/2.34.x.md index 986faf6d0df..393e397d1af 100644 --- a/docs/notes/2.34.x.md +++ b/docs/notes/2.34.x.md @@ -18,6 +18,8 @@ Thank you to [Klaviyo](https://www.klaviyo.com/) for their Platinum tier support Fixed a bug where `SingleSourceField` could not be hydrated for generated targets because files were validated before code generation ran. +The Rust engine now automatically falls back to common Podman socket paths (rootless and rootful) for `docker_environments` if the default Docker socket is unavailable. + ### Goals ### Backends diff --git a/src/rust/process_execution/docker/src/docker.rs b/src/rust/process_execution/docker/src/docker.rs index 850a4427839..d777ee087fb 100644 --- a/src/rust/process_execution/docker/src/docker.rs +++ b/src/rust/process_execution/docker/src/docker.rs @@ -95,8 +95,29 @@ impl DockerOnceCell { self .cell .get_or_try_init(async move { - let docker = Docker::connect_with_local_defaults() - .map_err(|err| format!("Failed to connect to local Docker: {err}"))?; + let docker = Docker::connect_with_local_defaults().or_else(|original_err| { + if let Ok(xdg) = std::env::var("XDG_RUNTIME_DIR") { + let podman_sock = format!("{}/podman/podman.sock", xdg); + if std::path::Path::new(&podman_sock).exists() { + let podman_uri = format!("unix://{}", podman_sock); + return Docker::connect_with_socket( + &podman_uri, + 120, + bollard::API_DEFAULT_VERSION + ); + } + } + + if std::path::Path::new("/run/podman/podman.sock").exists() { + return Docker::connect_with_socket( + "unix:///run/podman/podman.sock", + 120, + bollard::API_DEFAULT_VERSION + ); + } + + Err(original_err) + }).map_err(|err| format!("Failed to connect to local Docker/Podman: {err}"))?; let version = docker.version().await .map_err(|err| format!("Failed to obtain version from local Docker: {err}"))?;