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 Stringaddress()Get the Docker ip address or hostname.URIbindUri()Get the Docker rest bind uri.static StringcertPathFromEnv()static StringconfigPathFromEnv()static StringdefaultAddress()static StringdefaultCertPath()static intdefaultPort()static StringdefaultUnixEndpoint()static StringdefaultWindowsEndpoint()StringdockerCertPath()Get the path to certificate and key for connecting to Docker via HTTPS.static StringendpointFromEnv()booleanequals(Object obj)static DockerHostfrom(String endpoint, String certPath)Create aDockerHostfrom an explicit address or uri.static DockerHostfromEnv()Create aDockerHostfrom DOCKER_HOST and DOCKER_PORT env vars.inthashCode()Stringhost()Get a Docker endpoint usable for instantiating a new DockerHost with DockerHost.from(endpoint).intport()Get the Docker endpoint port.StringtoString()URIuri()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 aDockerHostfrom DOCKER_HOST and DOCKER_PORT env vars.- Returns:
- The DockerHost object.
-
from
public static DockerHost from(String endpoint, String certPath)
Create aDockerHostfrom 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()
-
-