pub trait DockerSocketSpawner:
Send
+ Sync
+ Debug {
// Required methods
fn spawn<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
token: String,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn teardown<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Spawns and tears down a per-container Docker Engine API socket.
Implemented in the zlayer bin (which can see both zlayer-agent and the
higher-level zlayer-docker crate — the agent itself must NOT depend on
zlayer-docker, that would be a dependency cycle). The runtime calls
spawn when a container opts into zlayer.io/docker-socket
and teardown on stop/remove.
Required Methods§
Sourcefn spawn<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
token: String,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn spawn<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
token: String,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provision a per-container Docker Engine API socket authenticated as the
container’s scoped token, and return the HOST path of the socket to
bind-mount into the container at /var/run/docker.sock. The path is
derived deterministically from container_key, so the server task may
still be binding asynchronously when this returns (it connects to the
daemon first, then binds — near-instant since the daemon is already up).
Returns None on failure (the container still starts, just without a
docker socket). Idempotent per container_key.
Sourcefn teardown<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn teardown<'life0, 'life1, 'async_trait>(
&'life0 self,
container_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Abort the per-container socket server task and unlink its socket file. Safe to call for an unknown key (no-op).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".