Class DockerAPI

All Implemented Interfaces:
Describable<DockerAPI>

public class DockerAPI extends AbstractDescribableImpl<DockerAPI>
Author:
Nicolas De Loof
  • Constructor Details

    • DockerAPI

      @DataBoundConstructor public DockerAPI(org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost)
    • DockerAPI

      public DockerAPI(org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost, int connectTimeout, int readTimeout, String apiVersion, String hostname)
  • Method Details

    • getDockerHost

      public org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint getDockerHost()
    • getConnectTimeout

      public int getConnectTimeout()
    • setConnectTimeout

      @DataBoundSetter public void setConnectTimeout(int connectTimeout)
    • getReadTimeout

      public int getReadTimeout()
    • setReadTimeout

      @DataBoundSetter public void setReadTimeout(int readTimeout)
    • getApiVersion

      public String getApiVersion()
    • setApiVersion

      @DataBoundSetter public void setApiVersion(String apiVersion)
    • getHostname

      public String getHostname()
    • setHostname

      @DataBoundSetter public void setHostname(String hostname)
    • isSwarm

      public boolean isSwarm()
    • getClient

      public com.github.dockerjava.api.DockerClient getClient()
      Obtains a raw DockerClient pointing at our docker service endpoint. You MUST ensure that you call Closeable.close() on the returned instance after you are finished with it, otherwise we will leak resources.

      Note: DockerClients are cached and shared between threads, so taking and releasing is relatively cheap. They're not closed "for real" until they've been unused for some time.

      Returns:
      A raw DockerClient pointing at our docker service endpoint.
    • getClient

      public com.github.dockerjava.api.DockerClient getClient(int activityTimeoutInSeconds)
      As getClient(), but overriding the default readTimeout. This is typically used when running long-duration activities that can "go quiet" for a long period of time, e.g. pulling a docker image from a registry or building a docker image. Most users should just call getClient() instead.
      Parameters:
      activityTimeoutInSeconds - The activity timeout, in seconds. A value less than one means no timeout.
      Returns:
      A raw DockerClient pointing at our docker service endpoint.
    • getSocket

      public Socket getSocket() throws IOException
      Create a plain Socket to docker API endpoint
      Returns:
      The Socket direct to the docker daemon.
      Throws:
      IOException - if anything goes wrong.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object