Skip to content

DockerExecutor

Category: Shell

Source: docker_executor.dart

Classes

DockerExecutor

Runs shell commands inside a Docker container.

The project's working directory is bind-mounted at /workspace, and any additional [MountEntry]s from config or the session are added as volumes. Container cleanup (CID file removal, docker stop) is handled automatically on timeout or kill.

/workspace is the universal convention shared with future cloud runtimes (E2B, Daytona, Sprites, VibeKit-style providers). See docs/plans/2026-04-19-runtime-boundary-plan.md.

Constructor

dart
DockerExecutor({
    required this.config,
    required this.cwd,
    required this.mounts,
    this.eventSink,
  })

Properties

PropertyTypeDescription
configDockerConfig
cwdStringThe host directory to use as the container's working directory. Bind-mounted as /workspace inside the container — this is where all commands execute by default.
mountsList<MountEntry>
eventSinkRuntimeEventSink?
attemptsconst
delayconst
nullreturn

Methods

List<String> buildDockerArgs(String command, String cidfilePath)

Builds the full docker run argument list for [command].

[cidfilePath] is passed to --cidfile so Docker writes the container ID to disk — this lets us docker stop the container on timeout or kill without needing to parse docker ps.

Future<CaptureResult> runCapture(String command, {Duration? timeout})
Future<RunningCommandHandle> startStreaming(String command)
Future<void> kill({bool force = false})

DockerRunningCommand

A [RunningCommand] backed by a Docker container.

Extends the base kill behavior to docker stop the container before sending SIGTERM, and cleans up the CID temp file on process exit.

Constructor

dart
DockerRunningCommand(super.process, this._cidfile)

Methods

Future<void> kill({bool force = false})

Released under the MIT License.