ConnectionMode enum

Determines how DockerClient computes the host IP address and port for containers.

The mode is auto-detected based on the running environment but can be overridden via the TESTCONTAINERS_CONNECTION_MODE environment variable.

Inheritance
Available extensions

Values

bridgeIp → const ConnectionMode

Use the container's bridge-network IP address directly.

Ports are not remapped — the container port is used as-is. Suitable when the test process is running inside the same Docker network as the container.

gatewayIp → const ConnectionMode

Use the default-gateway IP of the Docker bridge network.

Ports are remapped via the Docker daemon's host-port mapping. Suitable when the test process is in a container on a different network than the containers under test.

dockerHost → const ConnectionMode

Use the Docker host's address (as resolved by DockerClient.host).

Ports are remapped. This is the default mode when the test process is running directly on the host machine.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useMappedPort bool
Returns true when this connection mode requires the Docker-assigned ephemeral host port rather than the container's internal port number.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<ConnectionMode>
A constant List of the values in this enum, in order of their declaration.