quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.76k stars 2.68k forks source link

[Extension Proposal] Docker Java Client #44255

Open zZHorizonZz opened 2 hours ago

zZHorizonZz commented 2 hours ago

Description

I have been working on a Quarkus Docker Java client for one of my projects. Since it's separate, I have decided to split it and make it into its own extension.

This extension adds the ability to configure and inject DockerClient from Docker Java Client. Also, if no host is configured, the host is configured automatically depending on the user's OS. If the user is using Unix, the unix:///var/run/docker.sock will be used if the user is on Windows, then npipe:////./pipe/docker_engine is used.

You can use the extension like this:

@Inject
DockerClient dockerClient;

// Use the client
dockerClient.pingCmd().exec();

Or you can create a named client like this:

@Inject
@NamedDockerClient("production")
DockerClient productionClient;

With configuration being like this:

# Production client configuration
quarkus.docker."production".docker-host=tcp://prod-host:2375
quarkus.docker."production".enabled=true

Currently, the extension doesn't support native mode as there are problems with using sockets in the library default http client. In the future, I think there could be a custom VertX implementation of this client, similar to how Fabric8 does it. The extension also provides a readiness health check to see if all clients started properly.

Repository name

quarkus-docker-client

Short description

Docker Java client integration for Quarkus

Repository Homepage URL

https://github.com/zZHorizonZz/quarkus-docker-client

Repository Topics

Team Members

Additional context

No response

quarkus-bot[bot] commented 2 hours ago

/cc @aloubyansky (extension-proposal), @gastaldi (extension-proposal), @gsmet (extension-proposal), @maxandersen (extension-proposal)