Class DockerHost

java.lang.Object
com.spotify.docker.client.DockerHost

public class DockerHost extends Object
Represents a dockerd endpoint. A codified DOCKER_HOST.
  • Field Details

  • Constructor Details

    • DockerHost

      private DockerHost(String endpoint, String certPath)
  • Method Details

    • 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.
    • setSystemDelegate

      static void setSystemDelegate(DockerHost.SystemDelegate delegate)
    • restoreSystemDelegate

      static void restoreSystemDelegate()
    • 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.
    • defaultDockerEndpoint

      static String defaultDockerEndpoint()
    • endpointFromEnv

      static String endpointFromEnv()
    • defaultUnixEndpoint

      public static String defaultUnixEndpoint()
    • defaultAddress

      public static String defaultAddress()
    • defaultPort

      public static int defaultPort()
    • portFromEnv

      static int portFromEnv()
    • defaultCertPath

      static String defaultCertPath()
    • certPathFromEnv

      static String certPathFromEnv()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object