Skip to content

DockerContainerOptions

Namespace: Hex1b

Assembly: Hex1b.dll

Options for configuring a Docker container as a terminal workload.

csharp
public sealed class DockerContainerOptions

Inheritance

ObjectDockerContainerOptions

Properties

AutoRemove

Gets or sets whether to automatically remove the container when it exits.

Returns: Boolean

csharp
public bool AutoRemove { get; set; }

BuildArgs

Gets the build arguments passed to docker build --build-arg.

Returns: Dictionary<String, String>

csharp
public Dictionary<string, string> BuildArgs { get; }

BuildContext

Gets or sets the build context directory for docker build.

Returns: String

csharp
public string? BuildContext { get; set; }

DockerfilePath

Gets or sets the path to a Dockerfile to build before starting the container.

Returns: String

csharp
public string? DockerfilePath { get; set; }

Environment

Gets the environment variables passed to the container via docker run -e.

Returns: Dictionary<String, String>

csharp
public Dictionary<string, string> Environment { get; }

Image

Gets or sets the Docker image to use for the container.

Returns: String

csharp
public string Image { get; set; }

MountDockerSocket

Gets or sets whether to mount the Docker socket into the container.

Returns: Boolean

csharp
public bool MountDockerSocket { get; set; }

Name

Gets or sets an explicit name for the container.

Returns: String

csharp
public string? Name { get; set; }

Network

Gets or sets the Docker network to connect the container to.

Returns: String

csharp
public string? Network { get; set; }

Shell

Gets or sets the shell to execute inside the container.

Returns: String

csharp
public string Shell { get; set; }

ShellArgs

Gets or sets the arguments passed to the shell.

Returns: String[]

csharp
public string[] ShellArgs { get; set; }

Volumes

Gets the volume mounts passed to the container via docker run -v.

Returns: List<String>

csharp
public List<string> Volumes { get; }

WorkingDirectory

Gets or sets the working directory inside the container.

Returns: String

csharp
public string? WorkingDirectory { get; set; }

Remarks

Use either or to specify the container image, but not both. When is set, the image is built automatically before starting the container.

The container runs interactively with a PTY attached, executing the configured with . All Hex1b terminal features (input sequences, pattern searching, recording) work unchanged because the container is driven through the existing PTY infrastructure.

Examples

csharp
var terminal = Hex1bTerminal.CreateBuilder()
    .WithHeadless()
    .WithDockerContainer(c =>
    {
        c.Image = "ubuntu:24.04";
        c.Environment["MY_VAR"] = "value";
        c.MountDockerSocket = true;
    })
    .Build();

Released under the MIT License.