Package io.jenkins.docker.client
Class DockerAPI
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<DockerAPI>
-
- io.jenkins.docker.client.DockerAPI
-
- All Implemented Interfaces:
Describable<DockerAPI>
public class DockerAPI extends AbstractDescribableImpl<DockerAPI>
- Author:
- Nicolas De Loof
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DockerAPI.DescriptorImpl
-
Constructor Summary
Constructors Constructor Description DockerAPI(org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost)
DockerAPI(org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost, int connectTimeout, int readTimeout, String apiVersion, String hostname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getApiVersion()
com.github.dockerjava.api.DockerClient
getClient()
Obtains a rawDockerClient
pointing at our docker service endpoint.com.github.dockerjava.api.DockerClient
getClient(int activityTimeoutInSeconds)
AsgetClient()
, but overriding the defaultreadTimeout
.int
getConnectTimeout()
org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint
getDockerHost()
String
getHostname()
int
getReadTimeout()
Socket
getSocket()
Create a plainSocket
to docker API endpointint
hashCode()
boolean
isSwarm()
void
setApiVersion(String apiVersion)
void
setConnectTimeout(int connectTimeout)
void
setHostname(String hostname)
void
setReadTimeout(int readTimeout)
String
toString()
-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Method Detail
-
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 rawDockerClient
pointing at our docker service endpoint. You MUST ensure that you callCloseable.close()
on the returned instance after you are finished with it, otherwise we will leak resources.Note:
DockerClient
s 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)
AsgetClient()
, but overriding the defaultreadTimeout
. 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 callgetClient()
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 plainSocket
to docker API endpoint- Returns:
- The
Socket
direct to the docker daemon. - Throws:
IOException
- if anything goes wrong.
-
-