Package org.mandas.docker.client.builder
Class BaseDockerClientBuilder<B extends BaseDockerClientBuilder<B>>
java.lang.Object
org.mandas.docker.client.builder.BaseDockerClientBuilder<B>
- Type Parameters:
B- the type of the builder
- All Implemented Interfaces:
DockerClientBuilder<B>
- Direct Known Subclasses:
JerseyDockerClientBuilder,ResteasyDockerClientBuilder
public abstract class BaseDockerClientBuilder<B extends BaseDockerClientBuilder<B>>
extends Object
implements DockerClientBuilder<B>
A convenience base class for implementing
DockerClientBuilders- Author:
- Dimitris Mandalidis
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.mandas.docker.client.builder.DockerClientBuilder
DockerClientBuilder.EntityProcessing -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected jakarta.ws.rs.client.Clientprotected intprotected longprotected longprotected intprotected longprotected DockerCertificatesStoreprotected DockerClientBuilder.EntityProcessingprotected Stringprotected jakarta.ws.rs.client.Clientprotected Stringprotected longprotected RegistryAuthSupplierprotected Stringprotected URIprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiVersion(String apiVersion) Set the Docker API version that will be used in the HTTP requests to Docker daemon.build()connectionPoolSize(int connectionPoolSize) Set the size of the connection pool for connections to Docker.connectTimeoutMillis(long connectTimeoutMillis) Set the timeout in milliseconds until a connection to Docker is established.protected abstract jakarta.ws.rs.client.Clientprotected abstract jakarta.ws.rs.client.ClientdockerCertificates(DockerCertificatesStore dockerCertificatesStore) Provide certificates to secure the connection to Docker.entityProcessing(DockerClientBuilder.EntityProcessing entityProcessing) Allows setting transfer encoding.fromEnv()Sets or overwritesuri()anddockerCertificates(DockerCertificatesStore)according to the values present in DOCKER_HOST and DOCKER_CERT_PATH environment variables.protected org.apache.http.conn.HttpClientConnectionManagergetConnectionManager(URI uri, org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> schemeRegistry, int connectionPoolSize) protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory>getSchemeRegistry(URI uri, DockerCertificatesStore certificateStore) Adds additional headers to be sent in all requests to the Docker Remote API.protected ProxyConfigurationreadTimeoutMillis(long readTimeoutMillis) Set the SO_TIMEOUT in milliseconds.registryAuthSupplier(RegistryAuthSupplier registryAuthSupplier) uri()Set the URI for connections to Docker.useProxy(boolean useProxy) Allows connecting to Docker Daemon using HTTP proxy.
-
Field Details
-
UNIX_SCHEME
-
NPIPE_SCHEME
-
DEFAULT_CONNECT_TIMEOUT_MILLIS
protected long DEFAULT_CONNECT_TIMEOUT_MILLIS -
DEFAULT_READ_TIMEOUT_MILLIS
protected long DEFAULT_READ_TIMEOUT_MILLIS -
DEFAULT_CONNECTION_POOL_SIZE
protected int DEFAULT_CONNECTION_POOL_SIZE -
ERROR_MESSAGE
-
uri
-
apiVersion
-
connectTimeoutMillis
protected long connectTimeoutMillis -
readTimeoutMillis
protected long readTimeoutMillis -
connectionPoolSize
protected int connectionPoolSize -
dockerCertificatesStore
-
useProxy
protected boolean useProxy -
registryAuthSupplier
-
headers
-
client
protected jakarta.ws.rs.client.Client client -
noTimeoutClient
protected jakarta.ws.rs.client.Client noTimeoutClient -
entityProcessing
-
-
Constructor Details
-
BaseDockerClientBuilder
public BaseDockerClientBuilder()
-
-
Method Details
-
fromEnv
Sets or overwritesuri()anddockerCertificates(DockerCertificatesStore)according to the values present in DOCKER_HOST and DOCKER_CERT_PATH environment variables.- Specified by:
fromEnvin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Returns:
- Modifies a builder that can be used to further customize and then build the client.
- Throws:
DockerCertificateException- if we could not build a DockerCertificates object
-
uri
- Specified by:
uriin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>
-
uri
Set the URI for connections to Docker.- Specified by:
uriin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
uri- URI String for connections to Docker- Returns:
- Builder
-
apiVersion
Set the Docker API version that will be used in the HTTP requests to Docker daemon.- Specified by:
apiVersionin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
apiVersion- String for Docker API version- Returns:
- Builder
-
connectTimeoutMillis
Description copied from interface:DockerClientBuilderSet the timeout in milliseconds until a connection to Docker is established. A timeout value of zero is interpreted as an infinite timeout.- Specified by:
connectTimeoutMillisin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
connectTimeoutMillis- connection timeout to Docker daemon in milliseconds- Returns:
- Builder
-
readTimeoutMillis
Description copied from interface:DockerClientBuilderSet the SO_TIMEOUT in milliseconds. This is the maximum period of inactivity between receiving two consecutive data packets from Docker.- Specified by:
readTimeoutMillisin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
readTimeoutMillis- read timeout to Docker daemon in milliseconds- Returns:
- Builder
-
dockerCertificates
Description copied from interface:DockerClientBuilderProvide certificates to secure the connection to Docker.- Specified by:
dockerCertificatesin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
dockerCertificatesStore- DockerCertificatesStore object- Returns:
- Builder
-
connectionPoolSize
Description copied from interface:DockerClientBuilderSet the size of the connection pool for connections to Docker. Note that due to a known issue, DefaultDockerClient maintains two separate connection pools, each of which is capped at this size. Therefore, the maximum number of concurrent connections to Docker may be up to 2 * connectionPoolSize.- Specified by:
connectionPoolSizein interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
connectionPoolSize- connection pool size- Returns:
- Builder
-
useProxy
Description copied from interface:DockerClientBuilderAllows connecting to Docker Daemon using HTTP proxy.- Specified by:
useProxyin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
useProxy- tells if Docker Client has to connect to docker daemon using HTTP Proxy- Returns:
- Builder
-
registryAuthSupplier
- Specified by:
registryAuthSupplierin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>
-
header
Description copied from interface:DockerClientBuilderAdds additional headers to be sent in all requests to the Docker Remote API.- Specified by:
headerin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
name- the header namevalue- the header value- Returns:
- this
-
uri
- Specified by:
uriin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Returns:
- the URI of the Docker engine
-
entityProcessing
Description copied from interface:DockerClientBuilderAllows setting transfer encoding. CHUNKED does not send the content-length header while BUFFERED does.By default ApacheConnectorProvider uses CHUNKED mode. Some Docker API end-points seems to fail when no content-length is specified but a body is sent.
- Specified by:
entityProcessingin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>- Parameters:
entityProcessing- is the requested entity processing to use when calling docker daemon (tcp protocol).- Returns:
- Builder
-
createClient
protected abstract jakarta.ws.rs.client.Client createClient() -
createNoTimeoutClient
protected abstract jakarta.ws.rs.client.Client createNoTimeoutClient() -
proxyFromEnv
-
build
- Specified by:
buildin interfaceDockerClientBuilder<B extends BaseDockerClientBuilder<B>>
-
getConnectionManager
protected org.apache.http.conn.HttpClientConnectionManager getConnectionManager(URI uri, org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> schemeRegistry, int connectionPoolSize) -
getSchemeRegistry
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> getSchemeRegistry(URI uri, DockerCertificatesStore certificateStore)
-