pub struct DockerSandbox { /* private fields */ }Expand description
Docker sandbox — the default provider.
Talks to the Docker Engine API through bollard — no docker CLI is
required inside the container. This matches the playground’s deployment model:
the Compose cloud service mounts the host /var/run/docker.sock (DooD) and
the API is reached directly over that socket (or whatever DOCKER_HOST
points at). DOCKER_HOST is honored (e.g. unix:///var/run/docker.sock or a
remote tcp://…); when unset the well-known socket locations are probed.
The daemon connection is lazy: constructing a sandbox never panics and
never fails, so the agent runtime (and the whole test suite) works on
machines without a reachable daemon — including macOS, where Docker Desktop
does not expose /var/run/docker.sock by default. The connection is
established on the first spawn/exec/destroy, which then returns
SandboxError::NotConfigured if no daemon could be reached.
Implementations§
Source§impl DockerSandbox
impl DockerSandbox
pub fn new() -> Self
Sourcepub fn runtime(&self) -> Option<&str>
pub fn runtime(&self) -> Option<&str>
Return the pinned container runtime, if any (e.g. "kata"). None
means the daemon’s default runtime.
Sourcepub fn with_socket(path: impl Into<String>) -> Self
pub fn with_socket(path: impl Into<String>) -> Self
Pin the sandbox to one socket path (no DOCKER_HOST/auto-discovery).
Sourcepub fn with_runtime(runtime: impl Into<String>) -> Self
pub fn with_runtime(runtime: impl Into<String>) -> Self
Build a sandbox that runs containers under a specific Docker runtime
(e.g. "kata"). Used by KataSandbox; reuses the same bollard client
and the same SandboxResourceLimits as the default Docker provider.
Sourcepub async fn client(&self) -> Result<&Docker, SandboxError>
pub async fn client(&self) -> Result<&Docker, SandboxError>
Resolve (and memoize) the daemon client.
Trait Implementations§
Source§impl Default for DockerSandbox
impl Default for DockerSandbox
Source§impl Sandbox for DockerSandbox
impl Sandbox for DockerSandbox
Source§fn spawn<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ExecSpec,
) -> Pin<Box<dyn Future<Output = Result<SandboxHandle, SandboxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn spawn<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 ExecSpec,
) -> Pin<Box<dyn Future<Output = Result<SandboxHandle, SandboxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 SandboxHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecOutput, SandboxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 SandboxHandle,
cmd: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<ExecOutput, SandboxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
cmd inside a previously spawned session.