ContainerExtraHost Class

An entry added to the /etc/hosts file of a container (--add-host).

public sealed class ContainerExtraHost : IEquatable<ContainerExtraHost>
Implements

Constructors

NameDescription
ContainerExtraHost(string, string)An entry added to the /etc/hosts file of a container (--add-host).

ContainerExtraHost(string, string)

ContainerExtraHost.cs

An entry added to the /etc/hosts file of a container (--add-host).

public ContainerExtraHost(string Hostname, string Address)

Parameters

Hostname string
The host name.
Address string
The IP address the host name resolves to, or ContainerExtraHost.HostGateway.

Properties

NameDescription
AddressGets the IP address the host name resolves to, or ContainerExtraHost.HostGateway.
HostnameGets the host name.

Gets the IP address the host name resolves to, or ContainerExtraHost.HostGateway.

public string Address { get; init; }

Property value

string

Gets the host name.

public string Hostname { get; init; }

Property value

string

Methods

NameDescription
Deconstruct(string, string)
Equals(ContainerExtraHost?)
Equals(object?)
ForHostGateway(string)Creates an entry that resolves a host name to the host, through ContainerExtraHost.HostGateway.
GetHashCode()
ToString()

Deconstruct(string, string)

public void Deconstruct(out string Hostname, out string Address)

Parameters

Hostname string
Address string

No documentation is available.

Equals overloads

Equals(ContainerExtraHost?)

public bool Equals(ContainerExtraHost? other)
Parameters
other ContainerExtraHost?
Returns

bool

No documentation is available.

Equals(object?)

public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

ForHostGateway(string)

ContainerExtraHost.cs

Creates an entry that resolves a host name to the host, through ContainerExtraHost.HostGateway.

public static ContainerExtraHost ForHostGateway(string hostname = "host.docker.internal")

Parameters

hostname string
The host name. Defaults to ContainerExtraHost.DefaultHostGatewayHostname.

Returns

ContainerExtraHost The entry.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(ContainerExtraHost?, ContainerExtraHost?)
operator !=(ContainerExtraHost?, ContainerExtraHost?)

operator ==(ContainerExtraHost?, ContainerExtraHost?)

public static bool operator ==(ContainerExtraHost? left, ContainerExtraHost? right)

Parameters

left ContainerExtraHost?
right ContainerExtraHost?

Returns

bool

No documentation is available.

operator !=(ContainerExtraHost?, ContainerExtraHost?)

public static bool operator !=(ContainerExtraHost? left, ContainerExtraHost? right)

Parameters

left ContainerExtraHost?
right ContainerExtraHost?

Returns

bool

No documentation is available.

Constants

NameDescription
DefaultHostGatewayHostnameThe host name Docker Desktop resolves to the host on its own, and that ContainerExtraHost.ForHostGateway uses by default.
HostGatewayThe special address the daemon replaces with the address of the host, which is how a container calls back to the test process on Linux.

DefaultHostGatewayHostname

The host name Docker Desktop resolves to the host on its own, and that ContainerExtraHost.ForHostGateway uses by default.

public const string DefaultHostGatewayHostname = "host.docker.internal"

HostGateway

The special address the daemon replaces with the address of the host, which is how a container calls back to the test process on Linux.

public const string HostGateway = "host-gateway"