The @QuarkusIntegrationTest in the project, whose final artefact is Jib-built docker image, tests this built image.
If there is Pulsar dev services required for this integration test, those Pulsar adresses are passed with properties pulsar.client.serviceUrl and pulsar.admin.serviceUrl. The hosts of these addresses are defined as localhost, which is correct for jar testing.
Problem occurs for MacOS. In the MacOS, Docker container localhost refers only to "this-container-localhost", which causes failure of reaching devservices via localhost.
The tested container should access Pulsar devservice via container's domain name (e.g. pulsar://pulsar-hash:6650 or http://pulsar-hash:8080) instead of localhost:<mappedPort>) in shared network.
Actual behavior
Accessing devservices on MacOS within Docker container via localhost causes java.net.ConnectException: Connection refused.
How to Reproduce?
Create example project quarkus create app
Add docker image building extension - quarkus extension add container-image-jib
Require building docker image by specifying Maven property <quarkus.container-image.build>true</quarkus.container-image.build>
Require running IT tests by specifying Maven property <skipITs>false</skipITs>
Describe the bug
This bug is similar to #43980
The @QuarkusIntegrationTest in the project, whose final artefact is Jib-built docker image, tests this built image.
If there is Pulsar dev services required for this integration test, those Pulsar adresses are passed with properties
pulsar.client.serviceUrl
andpulsar.admin.serviceUrl
. The hosts of these addresses are defined aslocalhost
, which is correct for jar testing.Problem occurs for MacOS. In the MacOS, Docker container localhost refers only to "this-container-localhost", which causes failure of reaching devservices via
localhost
.We can observe this behaviour in the logs:
Expected behavior
The tested container should access Pulsar devservice via container's domain name (e.g.
pulsar://pulsar-hash:6650
orhttp://pulsar-hash:8080
) instead oflocalhost:<mappedPort>
) in shared network.Actual behavior
Accessing devservices on MacOS within Docker container via localhost causes
java.net.ConnectException: Connection refused
.How to Reproduce?
quarkus create app
quarkus extension add container-image-jib
<quarkus.container-image.build>true</quarkus.container-image.build>
<skipITs>false</skipITs>
./mvnw clean install
code-with-quarkus.zip
Output of
uname -a
orver
Darwin MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64
Output of
java -version
openjdk version "21" 2023-09-19 OpenJDK Runtime Environment (build 21+35-2513) OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Quarkus version or git rev
3.15.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: /Users/jakub.gardo/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8 Java version: 21, vendor: Oracle Corporation, runtime: /Users/jakub.gardo/.sdkman/candidates/java/21-open Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x", version: "14.5", arch: "x86_64", family: "mac"
Additional information
No response