Package org.mandas.docker.client
Class DockerHost
- java.lang.Object
-
- org.mandas.docker.client.DockerHost
-
public class DockerHost extends Object
Represents a dockerd endpoint. A codified DOCKER_HOST.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
address()
Get the Docker ip address or hostname.URI
bindUri()
Get the Docker rest bind uri.static String
certPathFromEnv()
static String
configPathFromEnv()
static String
defaultAddress()
static String
defaultCertPath()
static int
defaultPort()
static String
defaultUnixEndpoint()
static String
defaultWindowsEndpoint()
String
dockerCertPath()
Get the path to certificate and key for connecting to Docker via HTTPS.static String
endpointFromEnv()
boolean
equals(Object obj)
static DockerHost
from(String endpoint, String certPath)
Create aDockerHost
from an explicit address or uri.static DockerHost
fromEnv()
Create aDockerHost
from DOCKER_HOST and DOCKER_PORT env vars.int
hashCode()
String
host()
Get a Docker endpoint usable for instantiating a new DockerHost with DockerHost.from(endpoint).int
port()
Get the Docker endpoint port.String
toString()
URI
uri()
Get the Docker rest uri.
-
-
-
Method Detail
-
host
public String host()
Get a Docker endpoint usable for instantiating a new DockerHost with DockerHost.from(endpoint).- Returns:
- A unix socket path or, in the case of a TCP socket, the hostname and port which represents a Docker endpoint.
-
uri
public URI uri()
Get the Docker rest uri.- Returns:
- The uri of the Docker endpoint.
-
bindUri
public URI bindUri()
Get the Docker rest bind uri.- Returns:
- The uri of the host for binding ports (or setting $DOCKER_HOST).
-
port
public int port()
Get the Docker endpoint port.- Returns:
- The port.
-
address
public String address()
Get the Docker ip address or hostname.- Returns:
- The ip address or hostname.
-
dockerCertPath
public String dockerCertPath()
Get the path to certificate and key for connecting to Docker via HTTPS.- Returns:
- The path to the certificate.
-
fromEnv
public static DockerHost fromEnv()
Create aDockerHost
from DOCKER_HOST and DOCKER_PORT env vars.- Returns:
- The DockerHost object.
-
from
public static DockerHost from(String endpoint, String certPath)
Create aDockerHost
from an explicit address or uri.- Parameters:
endpoint
- The Docker endpoint.certPath
- The certificate path.- Returns:
- The DockerHost object.
-
endpointFromEnv
public static String endpointFromEnv()
-
defaultUnixEndpoint
public static String defaultUnixEndpoint()
-
defaultWindowsEndpoint
public static String defaultWindowsEndpoint()
-
defaultAddress
public static String defaultAddress()
-
defaultPort
public static int defaultPort()
-
defaultCertPath
public static String defaultCertPath()
-
certPathFromEnv
public static String certPathFromEnv()
-
configPathFromEnv
public static String configPathFromEnv()
-
-