Class DockerHost


  • public class DockerHost
    extends Object
    Represents a dockerd endpoint. A codified DOCKER_HOST.
    • 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 a DockerHost from DOCKER_HOST and DOCKER_PORT env vars.
        Returns:
        The DockerHost object.
      • from

        public static DockerHost from​(String endpoint,
                                      String certPath)
        Create a DockerHost 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object