This discovery bridge imports services from Docker Links into the Vert.x service discovery.
When you link a Docker
container to another Docker container, Docker injects a set of environment variables. This bridge analyzes these
environment variables and imports service record for each link. The service type is deduced from the
label. If not set, the service is imported as
http-endpoint are supported for now.
As the links are created when the container starts, the imported records are created when the bridge starts and do not change afterwards.
To use this Vert.x discovery bridge, add the following dependency to the dependencies section of your build descriptor:
Maven (in your
<dependency> <groupId>io.vertx</groupId> <artifactId>vertx-service-discovery-bridge-docker-links</artifactId> <version>3.3.3</version> </dependency>
Gradle (in your
Then, when creating the service discovery, registers this bridge as follows:
ServiceDiscovery.create(vertx) .registerServiceImporter(new DockerLinksServiceImporter(), new JsonObject());
The bridge does not need any further configuration.