MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / connect_local_container_engine

Function connect_local_container_engine

crates/openshell-driver-vm/src/driver.rs:3266–3287  ·  view source on GitHub ↗

Try to connect to a local container engine (Docker or Podman). Tries Docker first (`connect_with_local_defaults`, which respects `DOCKER_HOST`). If Docker is unavailable, falls back to the Podman socket, which exposes a Docker-compatible API.

()

Source from the content-addressed store, hash-verified

3264/// `DOCKER_HOST`). If Docker is unavailable, falls back to the Podman
3265/// socket, which exposes a Docker-compatible API.
3266async fn connect_local_container_engine() -> Option<Docker> {
3267 if let Ok(docker) = Docker::connect_with_local_defaults()
3268 && docker.ping().await.is_ok()
3269 {
3270 return Some(docker);
3271 }
3272
3273 let podman_socket = podman_socket_path();
3274 if podman_socket.exists()
3275 && let Ok(docker) =
3276 Docker::connect_with_unix(podman_socket.to_str()?, 120, bollard::API_DEFAULT_VERSION)
3277 && docker.ping().await.is_ok()
3278 {
3279 info!(
3280 socket = %podman_socket.display(),
3281 "vm driver: connected to Podman (Docker-compatible API)"
3282 );
3283 return Some(docker);
3284 }
3285
3286 None
3287}
3288
3289/// Podman user socket path for the current platform.
3290fn podman_socket_path() -> PathBuf {

Callers 1

Calls 3

existsMethod · 0.80
podman_socket_pathFunction · 0.70
pingMethod · 0.45

Tested by

no test coverage detected