pub struct LocalRuntime {
pub detected: DetectedRuntime,
pub docker_host: String,
}Expand description
Reachable local container daemon — the winning provider from the cascade.
Fields§
§detected: DetectedRuntime§docker_host: StringDOCKER_HOST value used for every docker CLI invocation against this
runtime (e.g. "unix:///…" or "tcp://localhost:2375").
Implementations§
Source§impl LocalRuntime
impl LocalRuntime
Sourcepub async fn detect(spec: &LocalContainerSpec) -> Result<Self>
pub async fn detect(spec: &LocalContainerSpec) -> Result<Self>
Probe providers in spec.runtime order. Auto walks the full cascade
orbstack → docker-desktop → colima → podman → docker → custom; a
pinned preference probes only that runtime. Each socket path is
tilde-expanded and existence-checked.
Sourcepub async fn has_image(&self, image: &str) -> Result<bool>
pub async fn has_image(&self, image: &str) -> Result<bool>
True if image is already present in the local image store.
docker image inspect returns non-zero (without ‘unable to find’ on
stderr) when the image is absent.
Sourcepub async fn ensure_image(&self, image: &str) -> Result<bool>
pub async fn ensure_image(&self, image: &str) -> Result<bool>
Pull image only when it isn’t already cached. Returns true if a
pull happened, false if the image was already present. Image refs
should be tag-pinned (caddy:2.10-alpine) so this stays deterministic.
Sourcepub async fn ensure_network(&self, name: &str) -> Result<bool>
pub async fn ensure_network(&self, name: &str) -> Result<bool>
Idempotently create a docker bridge network. Returns true if a
network was created, false if one already existed under name.
Used by the pond per-cell bridge bring-up (R455-F1).
Sourcepub async fn remove_container(&self, name: &str) -> Result<()>
pub async fn remove_container(&self, name: &str) -> Result<()>
Best-effort docker rm -f <name> — silent when the container is
already gone. Used before run to clear orphans from a prior crash.
Sourcepub async fn run(&self, spec: &ContainerRunSpec) -> Result<()>
pub async fn run(&self, spec: &ContainerRunSpec) -> Result<()>
Start a detached container per spec. Pre-clears any prior container
with the same name so re-runs after a crash are idempotent.
Sourcepub async fn container_host_port(
&self,
name: &str,
container_port: u16,
) -> Result<u16>
pub async fn container_host_port( &self, name: &str, container_port: u16, ) -> Result<u16>
Read the host-side port that the container mapped container_port/tcp
to. Runs docker port <name> <container_port> and parses the output
(0.0.0.0:XXXXX or :::XXXXX). Returns an error when the container is
not running or the port is not published.
Sourcepub async fn container_state(
&self,
name: &str,
) -> Result<Option<ContainerState>>
pub async fn container_state( &self, name: &str, ) -> Result<Option<ContainerState>>
Fetch the container’s State.Status field (running / exited / …).
Returns Ok(None) when the container doesn’t exist.
Sourcepub async fn stop_and_remove(&self, name: &str, grace: Duration) -> Result<()>
pub async fn stop_and_remove(&self, name: &str, grace: Duration) -> Result<()>
Graceful docker stop -t <grace_seconds> followed by docker rm.
No-op if the container doesn’t exist.
Sourcepub async fn list_owned(&self) -> Result<Vec<OwnedContainer>>
pub async fn list_owned(&self) -> Result<Vec<OwnedContainer>>
List every container owned by this module on this runtime.
Queries both yah.pond (current) and yah.local-sim (legacy, pre-R362)
label keys so old-generation containers are visible during the transition.
Trait Implementations§
Source§impl Clone for LocalRuntime
impl Clone for LocalRuntime
Source§fn clone(&self) -> LocalRuntime
fn clone(&self) -> LocalRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more