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

Function docker_daemon_platform

crates/openshell-bootstrap/src/build.rs:31–49  ·  view source on GitHub ↗
(docker: &Docker)

Source from the content-addressed store, hash-verified

29const DEFAULT_BUILD_NO_PROGRESS_TIMEOUT_SECS: u64 = 1800;
30
31async fn docker_daemon_platform(docker: &Docker) -> Result<String> {
32 let info = docker
33 .info()
34 .await
35 .into_diagnostic()
36 .wrap_err("failed to query local Docker daemon info")?;
37 let os = info
38 .os_type
39 .as_deref()
40 .filter(|value| !value.is_empty())
41 .ok_or_else(|| miette::miette!("Docker daemon did not report an operating system"))?;
42 let arch = info
43 .architecture
44 .as_deref()
45 .filter(|value| !value.is_empty())
46 .ok_or_else(|| miette::miette!("Docker daemon did not report an architecture"))?;
47
48 normalize_docker_platform(os, arch)
49}
50
51fn normalize_docker_platform(os: &str, arch: &str) -> Result<String> {
52 // Remote or non-standard daemons may return mixed-case arch strings.

Callers 1

build_imageFunction · 0.85

Calls 2

is_emptyMethod · 0.45

Tested by

no test coverage detected