Expand description
strop-containers: attach to an existing container on the local Docker engine and browse/read its filesystem (0037 DC1a — browse/read).
§Capability boundary (read-only by construction)
This crate exposes exactly four engine conversations: probe (docker info), discovery (docker ps + docker inspect), and filesystem reads
(docker cp … - tar streams). There is deliberately no write, delete,
exec-of-arbitrary-argv, LSP or Git surface: those are DC1b policy
decisions, not accidental omissions. Unsupported operations are refused
with typed errors (ContainerError::CapabilityRefused), never silently
approximated.
§Ownership and identity
- Attaching never transfers lifecycle ownership: nothing here creates, stops, restarts or removes a container, and no local path is ever touched — a container path is not aliased to an analogous host path.
- The engine is the local Docker CLI only (argv arrays, never shell strings). Remote engines are DC5; no SSH daemon inside the container is required or used.
- Identity is the canonical 64-hex inspect id plus the incarnation
(
State.StartedAt), never a container name alone. A name that re-resolves to a different id is a stale-identity refusal; a container that restarts between inspect and read is detected by a cheapstarted_atre-check before every read.
§Process policy
Every docker invocation runs through strop_core::process
supervision: an OwnedProcess
process group, the caller’s [CancelToken], a wall-clock deadline and
bounded pipe retention. Directory listings stream the tar archive
through an incremental parser that retains only direct-child metadata,
so a subtree’s bulk bounds the transfer, never the memory; a listing
whose retained metadata overflows its bound is refused, and file reads
truncate by explicit max semantics — nothing partial is ever
presented as complete.
Structs§
- Container
Identity - One container as the engine described it at inspect time. Plain data —
resolving or re-checking it is
crate::inspect/crate::revalidate’s job, never this struct’s. - Container
Ref - A canonical, incarnation-pinned reference to one running container.
- DirEntry
- One direct child of a listed directory.
- Engine
Ref - The local Docker engine, proven reachable by a bounded probe.
Enums§
- Container
Error - Why a container operation did not produce a result.
- DirEntry
Kind - What one directory entry is.
Functions§
- engine
- Probe the local engine:
docker infomust succeed and report a server version. CLI missing, daemon down or a timed-out probe are allContainerError::EngineUnavailable. - exec_
capture - One bounded command run inside the container (0037 DC1b): Git and friends. argv-only, supervised, deadline-bounded pipes. The engine was probed by the caller; the container id is canonical.
- exec_
command - A
docker exec -icommand channel for one in-container program: piped stdin/stdout/stderr, working directory inside the container. The caller owns process supervision (group, kill-on-drop) as with every strop process launch. The id is the canonical inspect id — incarnation pinning is the read path’s concern; a spawned session’s liveness is scoped to itself. - inspect
- Resolve a name or id prefix to the container’s identity, canonical
64-hex id included. Names are validated before the engine sees them;
an unknown name is
ContainerError::NoSuchContainer, never a best-effort guess. - list_
dir - The direct children of
pathinside the container, parsed strictly from the tar archive the engine streams for the directory. - list_
running - The engine’s running containers as full identities:
psfor the id set, one batchedinspectfor the records. Containers that stop in between are dropped — this lists running containers only. - read_
file - The first
maxbytes of the file atpathinside the container (head -csemantics: a larger file yields exactlymaxbytes, never an error for size alone). - revalidate
- Re-resolve a previously inspected identity by name. The stale-identity refusal lives here: a name that now maps to a different id, or the same id restarted since, must not silently inherit the old identity’s reads, caches or completions.