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 build_image(
&self,
tag: &str,
dockerfile: &Path,
context: &Path,
) -> Result<()>
pub async fn build_image( &self, tag: &str, dockerfile: &Path, context: &Path, ) -> Result<()>
Build a local image from a Dockerfile via docker build -t <tag> -f <dockerfile> <context>. Unlike ensure_image
(which pulls a published ref) this compiles the component’s own image
from source — the kind = "container" reconciler path (R602-T1).
dockerfile is the path to the Dockerfile; context is the build
context directory. Both are passed to docker verbatim, so the caller
resolves them to real paths first. Docker’s layer cache makes repeat
builds of an unchanged tree cheap, so callers may build unconditionally
on every reconcile without a separate freshness check.
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 moreSource§impl ContainerLauncher for LocalRuntime
impl ContainerLauncher for LocalRuntime
Source§fn ensure_image<'life0, 'life1, 'async_trait>(
&'life0 self,
image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_image<'life0, 'life1, 'async_trait>(
&'life0 self,
image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
image unless it is already present. true when a pull happened.Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ContainerRunSpec,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ContainerRunSpec,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
spec, replacing any prior container of
the same name.Source§fn stop_and_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_and_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
grace, then remove. No-op when the container is absent.