Skip to content

DockerConfig

Category: Shell

Source: docker_config.dart

Enums

MountMode

ValueDescription
ro
rw

Classes

MountEntry

Constructor

dart
MountEntry({
    required this.hostPath,
    this.mode = MountMode.rw,
    this.containerPath,
    this.addedAt,
  })
dart
factory MountEntry.parse(String spec)

Parses a Docker-style mount spec into a [MountEntry].

The format mirrors Docker's -v syntax for familiarity:

/host/path                       → rw, same container path
/host/path:/container/path       → rw, explicit container path
/host/path:ro                    → read-only, same container path
/host/path:/container/path:ro    → read-only, explicit container path

Throws [ArgumentError] if the spec is empty or the host path isn't absolute.

dart
factory MountEntry.fromJson(Map<String, dynamic> json)

Properties

PropertyTypeDescription
hostPathString
modeMountMode
containerPathString?Where to mount this path inside the container. When null, the [hostPath] is used as the container path too, so /home/me/project mounts at /home/me/project inside the container.
addedAtDateTime?

Methods

String toDockerArg()

Formats this entry as a Docker -v volume argument.

dart
MountEntry(hostPath: '/src', mode: MountMode.ro).toDockerArg()
// =&gt; '/src:/src:ro'
static List&lt;MountEntry&gt; dedup(List&lt;MountEntry&gt; entries)

Removes duplicate mounts, keeping the last entry for each unique path/mode combo.

Applied before building Docker args so that config-level mounts and session-level mounts can overlap without producing duplicate -v flags.

DockerConfig

Constructor

dart
const DockerConfig({
    this.enabled = false,
    this.image = 'ubuntu:24.04',
    this.shell = 'sh',
    this.fallbackToHost = true,
    this.mounts = const [],
  })

Properties

PropertyTypeDescription
enabledbool
imageString
shellString
fallbackToHostbool
mountsList&lt;MountEntry&gt;

Released under the MIT License.