Skip to content

RootContainer

Defined in: packages/runtime/src/container/types.ts:595

Top-level container that owns a live UnixInstance and a ContainerRegistry of child containers.

Consumed — built by the RuntimeAware builder chain. A RootContainer extends Container with nested-container spawn APIs (run(), create()) and direct access to the underlying image / instance.

readonly containers: ContainerRegistry

Defined in: packages/runtime/src/container/types.ts:601

Child container registry.


readonly createdAt: number

Defined in: packages/runtime/src/container/types.ts:383

Epoch ms when the handle was constructed (independent of start()).

Container.createdAt


readonly exitCode: ExitCode | undefined

Defined in: packages/runtime/src/container/types.ts:379

PID-1 exit code. undefined until PID 1 exits.

Container.exitCode


readonly image: UnixImage

Defined in: packages/runtime/src/container/types.ts:603

The image this root was booted from.


readonly instance: UnixInstance

Defined in: packages/runtime/src/container/types.ts:605

The live UnixInstance backing this root container.


readonly name: string

Defined in: packages/runtime/src/container/types.ts:375

Container name — unique within the manager registry.

Container.name


readonly spec: ContainerSpec

Defined in: packages/runtime/src/container/types.ts:381

The spec this container was created from. Frozen.

Container.spec


readonly state: ContainerState

Defined in: packages/runtime/src/container/types.ts:377

Current lifecycle state. Snapshot — may change concurrently with async ops.

Container.state

[asyncDispose](): Promise<void>

Defined in: packages/runtime/src/container/types.ts:443

await using cleanup: stop if running, remove if not already removed.

Promise<void>

Container.[asyncDispose]


commit(): Promise<Layer>

Defined in: packages/runtime/src/container/types.ts:441

Freeze the writable upper layer into a new image layer (Docker commit).

Promise<Layer>

Container.commit


create(image, opts?): Promise<Container>

Defined in: packages/runtime/src/container/types.ts:599

Create a child container (in created state) in this root’s registry.

UnixImage

ContainerShorthand

Promise<Container>


drain(timeout?): Promise<void>

Defined in: packages/runtime/src/container/types.ts:412

Send SIGUSR1 to PID 1 for in-process draining, then fall back to kill on timeout.

number

Promise<void>

Transitions running → draining → stopped. Timeout defaults to 5000 ms.

Container.drain


exec(bin, argv?, opts?): Promise<ExitCode>

Defined in: packages/runtime/src/container/types.ts:430

Spawn a one-shot process inside the running container.

string

string[]

ExecOpts

Promise<ExitCode>

Valid only from running. Env layers over the container’s merged env; output is teed into the container log buffer.

tty: true toggles raw mode on /dev/cons around the call and restores cooked mode in a finally — safe against mid-exec exit.

Container.exec


kill(): Promise<void>

Defined in: packages/runtime/src/container/types.ts:406

Immediate SIGKILL to PID 1 and all descendants. No grace period.

Promise<void>

Valid from running or draining.

Container.kill


logs(): string

Defined in: packages/runtime/src/container/types.ts:439

Snapshot of the container’s merged stdout/stderr log buffer.

string

Container.logs


remove(): void

Defined in: packages/runtime/src/container/types.ts:421

Dispose namespace resources and log buffer; transitions to removed.

void

Not valid while running or draining — stop first.

Idempotent on removed.

Container.remove


restart(): Promise<void>

Defined in: packages/runtime/src/container/types.ts:414

Stop (if running) then start again. Used by restart policies.

Promise<void>

Container.restart


run(image, opts?): Promise<ExitCode>

Defined in: packages/runtime/src/container/types.ts:597

Shorthand: create + start + wait + remove a child.

UnixImage

ContainerShorthand

Promise<ExitCode>


start(): Promise<void>

Defined in: packages/runtime/src/container/types.ts:393

Build the namespace, construct a kernel, spawn PID 1.

Promise<void>

Valid from created, stopped, or failed. Throws from any other state.

On restart (from stopped/failed), the prior namespace is disposed and a fresh one is built — log buffer persists.

Container.start


stop(timeout?): Promise<void>

Defined in: packages/runtime/src/container/types.ts:400

Graceful shutdown: SIGTERM → wait timeout ms → SIGKILL on holdouts.

number

Promise<void>

Idempotent on stopped / failed (returns immediately).

Valid from running or draining.

Container.stop


wait(): Promise<ExitCode>

Defined in: packages/runtime/src/container/types.ts:437

Resolve with PID-1’s exit code.

Promise<ExitCode>

If PID 1 already exited, resolves with the cached code. If never started, throws. Otherwise waits for PID 1 to exit.

Container.wait