DockerEndpoint class final

Where the Docker daemon listens: a Unix socket or a TCP address.

resolve finds it the way the docker command does: DOCKER_HOST (unix:///path/docker.sock or tcp://host:2375) when set, else the first of the usual sockets that exists: /var/run/docker.sock, Docker Desktop's ~/.docker/run/docker.sock, Colima's ~/.colima/default/docker.sock, Rancher Desktop's ~/.rd/docker.sock and the rootless daemon's $XDG_RUNTIME_DIR/docker.sock. Windows' named pipe is not supported yet (set DOCKER_HOST=tcp://...). TLS (DOCKER_TLS_VERIFY) is not supported: tcp:// is plain HTTP.

Testcontainers (Java): DockerClientProviderStrategy (EnvironmentAndSystemPropertyClientProviderStrategy, UnixSocketClientProviderStrategy, ...).

Constructors

DockerEndpoint.tcp(String host, int port)
The daemon behind the TCP address host:port.
const
DockerEndpoint.unix(String socketPath)
The daemon behind the Unix socket at socketPath.
const

Properties

containerHost → String
The host the published ports of a container are reached on: 127.0.0.1 for a local socket (ports are published on the loopback interface only, so a test database is never open to the network), the daemon's own host for tcp://.
no setter
hashCode → int
The hash code for this object.
no setterinherited
host → String?
The TCP host, or null for a Unix socket.
final
isUnix → bool
Whether this is a Unix socket.
no setter
port → int?
The TCP port, or null for a Unix socket.
final
publishIp → String
The HostIp ports are published on: the loopback interface for a local socket, every interface for a remote daemon.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socketPath → String?
The path of the Unix socket, or null for a TCP endpoint.
final

Methods

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

Operators

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

Static Methods

candidateSockets(Map<String, String> environment) → List<String>
The sockets looked at when DOCKER_HOST is not set, in order.
resolve({Map<String, String>? environment}) → DockerEndpoint?
The endpoint of the daemon, or null with the reason in unavailableReason when none is configured or no socket exists.
unavailableReason({Map<String, String>? environment}) → String?
Why resolve finds no daemon, or null when it does.