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

Function docker_socket_candidates

crates/openshell-core/src/config.rs:208–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206}
207
208fn docker_socket_candidates() -> Vec<PathBuf> {
209 let mut candidates = Vec::new();
210
211 if let Ok(host) = std::env::var("DOCKER_HOST")
212 && let Some(path) = docker_host_unix_socket_path(&host)
213 {
214 candidates.push(path);
215 }
216
217 candidates.push(PathBuf::from("/var/run/docker.sock"));
218
219 if let Some(home) = std::env::var_os("HOME") {
220 candidates.push(PathBuf::from(home).join(".docker/run/docker.sock"));
221 }
222
223 if let Some(runtime_dir) = std::env::var_os("XDG_RUNTIME_DIR") {
224 candidates.push(PathBuf::from(runtime_dir).join("docker.sock"));
225 }
226
227 candidates
228}
229
230fn docker_host_unix_socket_path(host: &str) -> Option<PathBuf> {
231 let path = host.trim().strip_prefix("unix://")?;

Callers 1

docker_socket_availableFunction · 0.85

Calls 2

pushMethod · 0.80

Tested by

no test coverage detected