Quarkus Docker Client
The Quarkus Docker Client extension provides seamless integration with Docker through a native Java API. It supports multiple named clients, automatic platform-specific socket detection, and built-in health checks.
Key features:
-
Multiple named Docker client instances for different environments
-
Automatic platform-specific Docker daemon socket detection
-
Health check integration for Docker daemon connectivity
-
Registry authentication support
-
TLS/SSL configuration for secure daemon communication
Installation
If you want to use this extension, you need to add the io.quarkiverse.docker:quarkus-docker-client
extension first to your build file.
For instance, with Maven, add the following dependency to your POM file:
<dependency>
<groupId>io.quarkiverse.docker</groupId>
<artifactId>quarkus-docker-client</artifactId>
<version>0.0.4</version>
</dependency>
Usage
Default Client
Inject the default Docker client:
@Inject
DockerClient dockerClient;
// Use the client
dockerClient.pingCmd().exec();
Named Clients
Configure and use multiple Docker clients:
# Default client configuration
quarkus.docker.docker-host=tcp://localhost:2375
# Production client configuration
quarkus.docker."production".docker-host=tcp://prod-host:2375
quarkus.docker."production".enabled=true
@Inject
@NamedDockerClient("production")
DockerClient productionClient;
Extension Configuration Reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
---|---|---|
Determines whether this Docker client configuration is enabled. For the clients, this is true by default. Configuration property: Environment variable: |
boolean |
|
Specifies the connection timeout when connecting to the Docker daemon. This timeout applies to the initial connection establishment. If the connection cannot be established within this time, a timeout exception will be thrown. Configuration property: Environment variable: |
|
|
Specifies the read timeout for Docker API operations. This timeout applies to individual API operations after the connection has been established. If an operation takes longer than this timeout, it will be interrupted. Configuration property: Environment variable: |
|
|
Specifies the Docker daemon host URL. Supported formats include:
If not specified, the default will be platform-specific: unix:///var/run/docker.sock for Unix-like systems and npipe:////./pipe/docker_engine for Windows. Configuration property: Environment variable: |
string |
|
Specifies the path to the Docker config file. This file contains registry authentication details and other Docker configuration. If not specified, the default location (~/.docker/config.json) will be used. Configuration property: Environment variable: |
string |
|
Specifies the Docker API version to use. If not specified, the latest supported version will be negotiated with the Docker daemon automatically. Configuration property: Environment variable: |
string |
|
Specifies the Docker context to use. Docker contexts allow switching between different Docker endpoints and their associated authentication settings. Configuration property: Environment variable: |
string |
|
Specifies the path to the Docker TLS certificates. Required when using TLS authentication with the Docker daemon. The directory should contain ca.pem, cert.pem, and key.pem files. Configuration property: Environment variable: |
string |
|
Determines whether to verify TLS certificates when connecting to the Docker daemon. Should be enabled in production environments when using TLS. Configuration property: Environment variable: |
boolean |
|
Specifies the email address for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the username for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the password for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the Docker registry URL. Configuration property: Environment variable: |
string |
|
Controls whether the Docker client health check is enabled. When enabled, a health check will be registered that verifies the connection to the Docker daemon for all configured clients. This is useful for monitoring the availability of Docker services. Configuration property: Example:
Environment variable: |
boolean |
|
Determines whether this Docker client configuration is enabled. For the clients, this is true by default. Configuration property: Environment variable: |
boolean |
|
Specifies the connection timeout when connecting to the Docker daemon. This timeout applies to the initial connection establishment. If the connection cannot be established within this time, a timeout exception will be thrown. Configuration property: Environment variable: |
|
|
Specifies the read timeout for Docker API operations. This timeout applies to individual API operations after the connection has been established. If an operation takes longer than this timeout, it will be interrupted. Configuration property: Environment variable: |
|
|
Specifies the Docker daemon host URL. Supported formats include:
If not specified, the default will be platform-specific: unix:///var/run/docker.sock for Unix-like systems and npipe:////./pipe/docker_engine for Windows. Configuration property: Environment variable: |
string |
|
Specifies the path to the Docker config file. This file contains registry authentication details and other Docker configuration. If not specified, the default location (~/.docker/config.json) will be used. Configuration property: Environment variable: |
string |
|
Specifies the Docker API version to use. If not specified, the latest supported version will be negotiated with the Docker daemon automatically. Configuration property: Environment variable: |
string |
|
Specifies the Docker context to use. Docker contexts allow switching between different Docker endpoints and their associated authentication settings. Configuration property: Environment variable: |
string |
|
Specifies the path to the Docker TLS certificates. Required when using TLS authentication with the Docker daemon. The directory should contain ca.pem, cert.pem, and key.pem files. Configuration property: Environment variable: |
string |
|
Determines whether to verify TLS certificates when connecting to the Docker daemon. Should be enabled in production environments when using TLS. Configuration property: Environment variable: |
boolean |
|
Specifies the email address for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the username for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the password for Docker registry authentication. Configuration property: Environment variable: |
string |
|
Specifies the Docker registry URL. Configuration property: Environment variable: |
string |
About the Duration format
To write duration values, use the standard You can also use a simplified format, starting with a number:
In other cases, the simplified format is translated to the
|