Table of Contents

Class ContainerGameHost

Namespace
Valheim.Testing.GameSessions
Assembly
Valheim.Testing.GameSessions.dll

A running container on this machine's Docker daemon, driven with docker exec -i. Scripts run as the given user in the container's shell. A Docker error, or a shell the container lacks, without the host's exit report is a transport failure. The container's ValheimCLI is reachable only when the container shares this machine's network (--network host, Linux): a published port reaches the container's own interface, never its loopback, and the CLI must not listen anywhere else.

public sealed class ContainerGameHost : ScriptedGameHost, IGameHost
Inheritance
object
ContainerGameHost
Implements
Inherited Members

Constructors

ContainerGameHost(string, string, HostShell, string?, string)

public ContainerGameHost(string name, string container, HostShell shell, string? user = null, string dockerExecutable = "docker")

Parameters

name string
container string

The container's name or id.

shell HostShell
user string

The user scripts run as (docker exec --user); the container's default when null.

dockerExecutable string

The Docker CLI; docker from PATH by default.

Exceptions

ArgumentException

A PowerShell shell: a container is a Linux host, which runs bash.

Properties

Container

public string Container { get; }

Property Value

string

Kind

public override GameHostKind Kind { get; }

Property Value

GameHostKind

User

public string? User { get; }

Property Value

string

Methods

OpenCliTunnelAsync(int, TimeSpan, int, CancellationToken)

Returns the ValheimCLI port itself when the container uses the host network; otherwise refuses with System.NotSupportedException rather than suggesting a CLI that listens beyond loopback.

public override Task<CliTunnel> OpenCliTunnelAsync(int hostPort, TimeSpan readyTimeout, int localPort = 0, CancellationToken cancellation = default)

Parameters

hostPort int
readyTimeout TimeSpan
localPort int
cancellation CancellationToken

Returns

Task<CliTunnel>