This is an automated email from the ASF dual-hosted git repository.

fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0a0e66e1afd26381e019d09f6cf0fca7b634f163
Author: Croway <[email protected]>
AuthorDate: Thu Feb 5 14:44:25 2026 +0100

    Camel Infra run specify custom port
---
 .../apache/camel/catalog/test-infra/metadata.json  |  54 ++++++++++
 .../jbang-commands/camel-jbang-infra-run.adoc      |   1 +
 .../META-INF/camel-jbang-commands-metadata.json    |   2 +-
 .../dsl/jbang/core/commands/infra/InfraRun.java    |  16 ++-
 test-infra/camel-test-infra-all/pom.xml            |  74 +++++++++++--
 .../src/generated/resources/META-INF/metadata.json |  54 ++++++++++
 .../infra/arangodb/services/ArangoDbContainer.java |  15 ++-
 .../services/AbstractArtemisEmbeddedService.java   |  18 +++-
 .../infra/artemis/services/ArtemisContainer.java   |  10 +-
 .../test/infra/aws2/services/AWSContainer.java     |   7 +-
 .../azure/common/services/AzuriteContainer.java    |  10 +-
 .../CassandraLocalContainerInfraService.java       |   6 +-
 .../ChatScriptLocalContainerInfraService.java      |  16 ++-
 .../common/services/ContainerEnvironmentUtil.java  | 116 +++++++++++++++++++--
 .../CouchbaseLocalContainerInfraService.java       |  15 ++-
 .../CouchDbLocalContainerInfraService.java         |   6 +-
 .../DoclingLocalContainerInfraService.java         |   7 +-
 .../ElasticSearchLocalContainerInfraService.java   |   6 +-
 .../services/FhirLocalContainerInfraService.java   |   6 +-
 .../services/embedded/FtpEmbeddedInfraService.java |   2 +-
 .../embedded/FtpsEmbeddedInfraService.java         |   7 +-
 .../embedded/SftpEmbeddedInfraService.java         |   2 +-
 .../GooglePubSubLocalContainerInfraService.java    |   6 +-
 .../HashicorpVaultLocalContainerInfraService.java  |   7 +-
 .../LocalHiveMQSparkplugTCKInfraService.java       |   6 +-
 .../services/IbmMQLocalContainerInfraService.java  |   9 +-
 .../test/infra/iggy/services/IggyContainer.java    |   9 +-
 .../InfinispanLocalContainerInfraService.java      |   8 +-
 .../infra/kafka/services/ConfluentContainer.java   |   3 +-
 .../kafka/services/ConfluentInfraService.java      |   4 +-
 .../services/ContainerLocalKafkaInfraService.java  |   5 +-
 .../infra/kafka/services/RedpandaInfraService.java |   4 +-
 .../infra/kafka/services/StrimziContainer.java     |   3 +-
 .../infra/kafka/services/StrimziInfraService.java  |   8 +-
 .../services/ContainerLocalAuthKafkaService.java   |   3 +-
 .../KeycloakLocalContainerInfraService.java        |   7 +-
 .../MicroprofileLRALocalContainerInfraService.java |   6 +-
 .../services/MilvusLocalContainerInfraService.java |   7 +-
 .../services/MinioLocalContainerInfraService.java  |   7 +-
 .../MongoDBLocalContainerInfraService.java         |  10 +-
 .../MosquittoLocalContainerInfraService.java       |   3 +-
 .../services/NatsLocalContainerInfraService.java   |   6 +-
 .../services/Neo4jLocalContainerInfraService.java  |   9 +-
 .../services/OllamaLocalContainerInfraService.java |   4 +-
 .../infra/openldap/services/OpenLdapContainer.java |  12 +--
 .../OpenSearchLocalContainerInfraService.java      |   4 +-
 .../pinecone/services/PineconeIndexContainer.java  |   7 +-
 .../PineconeLocalContainerInfraService.java        |   4 +-
 .../PostgresLocalContainerInfraService.java        |   4 +-
 .../services/PulsarLocalContainerInfraService.java |   7 +-
 .../services/QdrantLocalContainerInfraService.java |   7 +-
 .../RabbitMQLocalContainerInfraService.java        |  11 +-
 .../test/infra/redis/services/RedisContainer.java  |  11 +-
 .../services/RedisLocalContainerInfraService.java  |  11 +-
 .../rocketmq/services/RocketMQBrokerContainer.java |  14 ++-
 .../test/infra/smb/services/SmbContainer.java      |   7 +-
 .../test/infra/solr/services/SolrContainer.java    |   7 +-
 .../TorchServeLocalContainerInfraService.java      |  11 +-
 .../WeaviateLocalContainerInfraService.java        |   7 +-
 .../infra/xmpp/services/XmppServerContainer.java   |  15 ++-
 .../zookeeper/services/ZooKeeperContainer.java     |   7 +-
 .../ZooKeeperLocalContainerInfraService.java       |   7 +-
 62 files changed, 496 insertions(+), 241 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
index a76744e806f9..79b78435abb7 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
@@ -43,6 +43,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-aws-v2",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.iggy.services.IggyInfraService",
+  "description" : "Iggy distributed message streaming platform",
+  "implementation" : 
"org.apache.camel.test.infra.iggy.services.IggyLocalContainerInfraService",
+  "alias" : [ "iggy" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-iggy",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.aws.common.services.AWSInfraService",
   "description" : "Local AWS Services with LocalStack",
@@ -376,6 +385,24 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-xmpp",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : 
"org.apache.camel.test.infra.weaviate.services.WeaviateInfraService",
+  "description" : "Weaviate Vector Database",
+  "implementation" : 
"org.apache.camel.test.infra.weaviate.services.WeaviateLocalContainerInfraService",
+  "alias" : [ "weaviate" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-weaviate",
+  "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.consul.services.ConsulInfraService",
+  "description" : "Consul is a service networking solution",
+  "implementation" : 
"org.apache.camel.test.infra.consul.services.ConsulLocalContainerInfraService",
+  "alias" : [ "consul" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-consul",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : "org.apache.camel.test.infra.pulsar.services.PulsarInfraService",
   "description" : "Distributed messaging and streaming platform",
@@ -484,6 +511,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-aws-v2",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : 
"org.apache.camel.test.infra.pinecone.services.PineconeInfraService",
+  "description" : "Pinecone Vector Database",
+  "implementation" : 
"org.apache.camel.test.infra.pinecone.services.PineconeLocalContainerInfraService",
+  "alias" : [ "pinecone" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-pinecone",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.google.pubsub.services.GooglePubSubInfraService",
   "description" : "Google Cloud SDK Tool",
@@ -511,6 +547,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-arangodb",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.ignite.services.IgniteInfraService",
+  "description" : "Distributed Database Apache Ignite",
+  "implementation" : 
"org.apache.camel.test.infra.ignite.services.IgniteEmbeddedInfraService",
+  "alias" : [ "ignite" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-ignite",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : "org.apache.camel.test.infra.ftp.services.FtpInfraService",
   "description" : "Embedded FTP Server",
@@ -538,6 +583,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-mosquitto",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.neo4j.services.Neo4jInfraService",
+  "description" : "Neo4j Database",
+  "implementation" : 
"org.apache.camel.test.infra.neo4j.services.Neo4jLocalContainerInfraService",
+  "alias" : [ "neo4j" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-neo4j",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.rocketmq.services.RocketMQInfraService",
   "description" : "Apache RocketMQ is a distributed messaging and streaming 
platform",
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-infra-run.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-infra-run.adoc
index 6c3cf3e68852..bc7b7bcf2c93 100644
--- 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-infra-run.adoc
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-infra-run.adoc
@@ -22,6 +22,7 @@ camel infra run [options]
 | `--background` | Run in the background | false | boolean
 | `--json` | Output in JSON Format |  | boolean
 | `--log` | Log container output to console |  | boolean
+| `--port` | Override the default port for the service |  | Integer
 | `-h,--help` | Display the help and sub-commands |  | boolean
 |===
 
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
index 6fedc3030bea..ad43620195b7 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
@@ -15,7 +15,7 @@
     { "name": "get", "fullName": "get", "description": "Get status of Camel 
integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.CamelStatus", "options": [ { 
"names": "--watch", "description": "Execute periodically and showing output 
fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": 
"-h,--help", "description": "Display the help and sub-commands", "javaType": 
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "bean", 
"fullName": "get  [...]
     { "name": "harden", "fullName": "harden", "description": "Suggest security 
hardening for Camel routes using AI\/LLM", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.Harden", "options": [ { "names": 
"--api-key", "description": "API key for authentication. Also reads 
OPENAI_API_KEY or LLM_API_KEY env vars", "javaType": "java.lang.String", 
"type": "string" }, { "names": "--api-type", "description": "API type: 'ollama' 
or 'openai' (OpenAI-compatible)", "defaultValue": "ollama", [...]
     { "name": "hawtio", "fullName": "hawtio", "description": "Launch Hawtio 
web console", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.Hawtio", "options": [ { 
"names": "--openUrl", "description": "To automatic open Hawtio web console in 
the web browser", "defaultValue": "true", "javaType": "boolean", "type": 
"boolean" }, { "names": "--port", "description": "Port number to use for Hawtio 
web console (port 8888 by default)", "defaultValue": "8888", "javaType": "int", 
"t [...]
-    { "name": "infra", "fullName": "infra", "description": "List and Run 
external services for testing and prototyping", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.infra.InfraCommand", "options": [ { 
"names": "--json", "description": "Output in JSON Format", "javaType": 
"boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display 
the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], 
"subcommands": [ { "name": "get", "fullName": "infra  [...]
+    { "name": "infra", "fullName": "infra", "description": "List and Run 
external services for testing and prototyping", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.infra.InfraCommand", "options": [ { 
"names": "--json", "description": "Output in JSON Format", "javaType": 
"boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display 
the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], 
"subcommands": [ { "name": "get", "fullName": "infra  [...]
     { "name": "init", "fullName": "init", "description": "Creates a new Camel 
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Init", 
"options": [ { "names": "--clean-dir,--clean-directory", "description": 
"Whether to clean directory first (deletes all files in directory)", 
"javaType": "boolean", "type": "boolean" }, { "names": "--dir,--directory", 
"description": "Directory relative path where the new Camel integration will be 
saved", "defaultValue": ".", "javaType" [...]
     { "name": "jolokia", "fullName": "jolokia", "description": "Attach Jolokia 
JVM Agent to a running Camel integration", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.Jolokia", "options": [ { 
"names": "--port", "description": "To use a specific port number when attaching 
Jolokia JVM Agent (default a free port is found in range 8778-9999)", 
"javaType": "int", "type": "integer" }, { "names": "--stop", "description": 
"Stops the Jolokia JVM Agent in the running Camel inte [...]
     { "name": "log", "fullName": "log", "description": "Tail logs from running 
Camel integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.action.CamelLogAction", "options": [ 
{ "names": "--find", "description": "Find and highlight matching text (ignore 
case).", "javaType": "java.lang.String", "type": "string" }, { "names": 
"--follow", "description": "Keep following and outputting new log lines (press 
enter to exit).", "defaultValue": "true", "javaType": "boolean", "typ [...]
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraRun.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraRun.java
index b61559d71456..a44283b6171a 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraRun.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraRun.java
@@ -57,6 +57,10 @@ public class InfraRun extends InfraBaseCommand {
     @CommandLine.Option(names = { "--background" }, defaultValue = "false", 
description = "Run in the background")
     boolean background;
 
+    @CommandLine.Option(names = { "--port" },
+                        description = "Override the default port for the 
service")
+    Integer port;
+
     public InfraRun(CamelJBangMain main) {
         super(main);
     }
@@ -143,6 +147,11 @@ public class InfraRun extends InfraBaseCommand {
         String serviceInterface = testInfraService.service();
         String serviceImpl = testInfraService.implementation();
 
+        // Set the port property BEFORE instantiating the service so it can 
use the configured port
+        if (port != null) {
+            System.setProperty("camel.infra.port", String.valueOf(port));
+        }
+
         Object actualService = cl.loadClass(serviceImpl).newInstance();
 
         // Make sure the actualService can be run with initialize method
@@ -167,12 +176,16 @@ public class InfraRun extends InfraBaseCommand {
             }
             printer().println("Starting service " + testService + prefix + " 
(PID: " + RuntimeUtil.getPid() + ")");
         }
+
         actualService.getClass().getMethod("initialize").invoke(actualService);
 
         Method[] serviceMethods = 
cl.loadClass(serviceInterface).getDeclaredMethods();
         Map<String, Object> properties = new TreeMap<>();
         for (Method method : serviceMethods) {
-            if (method.getParameterCount() == 0 && 
!method.getName().contains("registerProperties")) {
+            // Skip methods that return complex objects or have side effects
+            if (method.getParameterCount() == 0
+                    && !method.getName().equals("registerProperties")
+                    && !method.getName().equals("getContainer")) {
                 Object value = null;
                 try {
                     value = method.invoke(actualService);
@@ -277,6 +290,7 @@ public class InfraRun extends InfraBaseCommand {
             } catch (Exception e) {
                 // ignore
             }
+            System.clearProperty("camel.infra.port");
         }
     }
 
diff --git a/test-infra/camel-test-infra-all/pom.xml 
b/test-infra/camel-test-infra-all/pom.xml
index 7fa7d89b8d36..c811262d2e6f 100644
--- a/test-infra/camel-test-infra-all/pom.xml
+++ b/test-infra/camel-test-infra-all/pom.xml
@@ -266,6 +266,36 @@
             <artifactId>camel-test-infra-docling</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-consul</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-iggy</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-ignite</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-neo4j</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-pinecone</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-weaviate</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -505,12 +535,6 @@
                                         
<artifactId>camel-test-infra-milvus</artifactId>
                                     </dependency>
                                 </fileSet>
-                                <fileSet>
-                                    <dependency>
-                                        <groupId>org.apache.camel</groupId>
-                                        
<artifactId>camel-test-infra-milvus</artifactId>
-                                    </dependency>
-                                </fileSet>
                                 <fileSet>
                                     <dependency>
                                         <groupId>org.apache.camel</groupId>
@@ -546,7 +570,43 @@
                                         <groupId>org.apache.camel</groupId>
                                         
<artifactId>camel-test-infra-docling</artifactId>
                                     </dependency>
-                                </fileSet>                                 
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-consul</artifactId>
+                                    </dependency>
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-iggy</artifactId>
+                                    </dependency>
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-ignite</artifactId>
+                                    </dependency>
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-neo4j</artifactId>
+                                    </dependency>
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-pinecone</artifactId>
+                                    </dependency>
+                                </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-weaviate</artifactId>
+                                    </dependency>
+                                </fileSet>
                             </fileSets>
                         </configuration>
                     </execution>
diff --git 
a/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
 
b/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
index a76744e806f9..79b78435abb7 100644
--- 
a/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
+++ 
b/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
@@ -43,6 +43,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-aws-v2",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.iggy.services.IggyInfraService",
+  "description" : "Iggy distributed message streaming platform",
+  "implementation" : 
"org.apache.camel.test.infra.iggy.services.IggyLocalContainerInfraService",
+  "alias" : [ "iggy" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-iggy",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.aws.common.services.AWSInfraService",
   "description" : "Local AWS Services with LocalStack",
@@ -376,6 +385,24 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-xmpp",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : 
"org.apache.camel.test.infra.weaviate.services.WeaviateInfraService",
+  "description" : "Weaviate Vector Database",
+  "implementation" : 
"org.apache.camel.test.infra.weaviate.services.WeaviateLocalContainerInfraService",
+  "alias" : [ "weaviate" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-weaviate",
+  "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.consul.services.ConsulInfraService",
+  "description" : "Consul is a service networking solution",
+  "implementation" : 
"org.apache.camel.test.infra.consul.services.ConsulLocalContainerInfraService",
+  "alias" : [ "consul" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-consul",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : "org.apache.camel.test.infra.pulsar.services.PulsarInfraService",
   "description" : "Distributed messaging and streaming platform",
@@ -484,6 +511,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-aws-v2",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : 
"org.apache.camel.test.infra.pinecone.services.PineconeInfraService",
+  "description" : "Pinecone Vector Database",
+  "implementation" : 
"org.apache.camel.test.infra.pinecone.services.PineconeLocalContainerInfraService",
+  "alias" : [ "pinecone" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-pinecone",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.google.pubsub.services.GooglePubSubInfraService",
   "description" : "Google Cloud SDK Tool",
@@ -511,6 +547,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-arangodb",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.ignite.services.IgniteInfraService",
+  "description" : "Distributed Database Apache Ignite",
+  "implementation" : 
"org.apache.camel.test.infra.ignite.services.IgniteEmbeddedInfraService",
+  "alias" : [ "ignite" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-ignite",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : "org.apache.camel.test.infra.ftp.services.FtpInfraService",
   "description" : "Embedded FTP Server",
@@ -538,6 +583,15 @@
   "groupId" : "org.apache.camel",
   "artifactId" : "camel-test-infra-mosquitto",
   "version" : "4.18.0-SNAPSHOT"
+}, {
+  "service" : "org.apache.camel.test.infra.neo4j.services.Neo4jInfraService",
+  "description" : "Neo4j Database",
+  "implementation" : 
"org.apache.camel.test.infra.neo4j.services.Neo4jLocalContainerInfraService",
+  "alias" : [ "neo4j" ],
+  "aliasImplementation" : [ ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-neo4j",
+  "version" : "4.18.0-SNAPSHOT"
 }, {
   "service" : 
"org.apache.camel.test.infra.rocketmq.services.RocketMQInfraService",
   "description" : "Apache RocketMQ is a distributed messaging and streaming 
platform",
diff --git 
a/test-infra/camel-test-infra-arangodb/src/main/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
 
b/test-infra/camel-test-infra-arangodb/src/main/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
index cb114d2b36a1..7a42824b07b2 100644
--- 
a/test-infra/camel-test-infra-arangodb/src/main/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
+++ 
b/test-infra/camel-test-infra-arangodb/src/main/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
@@ -18,6 +18,7 @@ package org.apache.camel.test.infra.arangodb.services;
 
 import org.apache.camel.test.infra.arangodb.common.ArangoDBProperties;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.GenericContainer;
@@ -36,14 +37,18 @@ public class ArangoDbContainer extends 
GenericContainer<ArangoDbContainer> {
     }
 
     public ArangoDbContainer(String containerName) {
+        this(containerName, true);
+    }
+
+    public ArangoDbContainer(String containerName, boolean fixedPort) {
         super(containerName);
 
         setWaitStrategy(Wait.forListeningPort());
-        addFixedExposedPort(PORT_DEFAULT, PORT_DEFAULT);
-        withNetworkAliases(CONTAINER_NAME)
-                .withEnv(ARANGO_NO_AUTH, "1")
-                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
-                .waitingFor(Wait.forLogMessage(".*is ready for business. Have 
fun!.*", 1));
+        ContainerEnvironmentUtil.configurePort(this, fixedPort, PORT_DEFAULT);
+        withNetworkAliases(CONTAINER_NAME);
+        withEnv(ARANGO_NO_AUTH, "1");
+        withLogConsumer(new Slf4jLogConsumer(LOGGER));
+        waitingFor(Wait.forLogMessage(".*is ready for business. Have fun!.*", 
1));
     }
 
     public int getServicePort() {
diff --git 
a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
 
b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
index fd1d6bf8820b..433edc285dfb 100644
--- 
a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
+++ 
b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
@@ -33,6 +33,7 @@ import 
org.apache.activemq.artemis.core.server.QueueQueryResult;
 import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.artemis.common.ArtemisRunException;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.artemis.common.ConnectionFactoryHelper;
 import org.apache.camel.test.infra.messaging.services.ConnectionFactoryAware;
 import org.slf4j.Logger;
@@ -48,8 +49,23 @@ public abstract class AbstractArtemisEmbeddedService 
implements ArtemisInfraServ
     private Consumer<Configuration> customConfigurator;
     private final int port;
 
+    private static final int DEFAULT_PORT = 61616;
+
     public AbstractArtemisEmbeddedService() {
-        this(AvailablePortFinder.getNextAvailable());
+        this(getPort());
+    }
+
+    private static int getPort() {
+        // Check if a port is configured via system property
+        String portStr = 
System.getProperty(ContainerEnvironmentUtil.INFRA_PORT_PROPERTY);
+        if (portStr != null && !portStr.isEmpty()) {
+            try {
+                return Integer.parseInt(portStr);
+            } catch (NumberFormatException e) {
+                // Fall through to random port
+            }
+        }
+        return AvailablePortFinder.getNextAvailable();
     }
 
     /**
diff --git 
a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisContainer.java
 
b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisContainer.java
index 0e29e767b350..ea132dcc63da 100644
--- 
a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisContainer.java
+++ 
b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisContainer.java
@@ -18,6 +18,7 @@ package org.apache.camel.test.infra.artemis.services;
 
 import org.apache.camel.test.infra.artemis.common.ArtemisProperties;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.messaging.services.MessagingContainer;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
@@ -46,10 +47,11 @@ public class ArtemisContainer extends 
GenericContainer<ArtemisContainer> impleme
 
     public static ArtemisContainer withFixedPort() {
         ArtemisContainer container = new ArtemisContainer();
-        container.addFixedExposedPort(DEFAULT_MQTT_PORT, DEFAULT_MQTT_PORT);
-        container.addFixedExposedPort(DEFAULT_AMQP_PORT, DEFAULT_AMQP_PORT);
-        container.addFixedExposedPort(DEFAULT_ADMIN_PORT, DEFAULT_ADMIN_PORT);
-        container.addFixedExposedPort(DEFAULT_ACCEPTOR_PORT, 
DEFAULT_ACCEPTOR_PORT);
+        ContainerEnvironmentUtil.configurePorts(container, true,
+                
ContainerEnvironmentUtil.PortConfig.primary(DEFAULT_ACCEPTOR_PORT),
+                
ContainerEnvironmentUtil.PortConfig.secondary(DEFAULT_MQTT_PORT),
+                
ContainerEnvironmentUtil.PortConfig.secondary(DEFAULT_AMQP_PORT),
+                
ContainerEnvironmentUtil.PortConfig.secondary(DEFAULT_ADMIN_PORT));
 
         return container;
     }
diff --git 
a/test-infra/camel-test-infra-aws-v2/src/main/java/org/apache/camel/test/infra/aws2/services/AWSContainer.java
 
b/test-infra/camel-test-infra-aws-v2/src/main/java/org/apache/camel/test/infra/aws2/services/AWSContainer.java
index 7d45e86b3c1a..3f24d54bb836 100644
--- 
a/test-infra/camel-test-infra-aws-v2/src/main/java/org/apache/camel/test/infra/aws2/services/AWSContainer.java
+++ 
b/test-infra/camel-test-infra-aws-v2/src/main/java/org/apache/camel/test/infra/aws2/services/AWSContainer.java
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
 import org.apache.camel.test.infra.aws.common.AWSProperties;
 import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.GenericContainer;
@@ -81,11 +82,7 @@ public class AWSContainer extends 
GenericContainer<AWSContainer> {
     }
 
     protected void setupContainer(boolean fixedPort) {
-        if (fixedPort) {
-            addFixedExposedPort(SERVICE_PORT, SERVICE_PORT);
-        } else {
-            withExposedPorts(SERVICE_PORT);
-        }
+        ContainerEnvironmentUtil.configurePort(this, fixedPort, SERVICE_PORT);
 
         waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
     }
diff --git 
a/test-infra/camel-test-infra-azure-common/src/main/java/org/apache/camel/test/infra/azure/common/services/AzuriteContainer.java
 
b/test-infra/camel-test-infra-azure-common/src/main/java/org/apache/camel/test/infra/azure/common/services/AzuriteContainer.java
index 4c3bfe6fe5d0..a5baedb9a877 100644
--- 
a/test-infra/camel-test-infra-azure-common/src/main/java/org/apache/camel/test/infra/azure/common/services/AzuriteContainer.java
+++ 
b/test-infra/camel-test-infra-azure-common/src/main/java/org/apache/camel/test/infra/azure/common/services/AzuriteContainer.java
@@ -18,6 +18,7 @@
 package org.apache.camel.test.infra.azure.common.services;
 
 import org.apache.camel.test.infra.azure.common.AzureCredentialsHolder;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
 
@@ -29,12 +30,9 @@ public class AzuriteContainer extends 
GenericContainer<AzuriteContainer> {
     public AzuriteContainer(String containerName, boolean fixedPort) {
         super(containerName);
 
-        if (fixedPort) {
-            addFixedExposedPort(AzureServices.BLOB_SERVICE, 
AzureServices.BLOB_SERVICE);
-            addFixedExposedPort(AzureServices.QUEUE_SERVICE, 
AzureServices.QUEUE_SERVICE);
-        } else {
-            withExposedPorts(AzureServices.BLOB_SERVICE, 
AzureServices.QUEUE_SERVICE);
-        }
+        ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                
ContainerEnvironmentUtil.PortConfig.primary(AzureServices.BLOB_SERVICE),
+                
ContainerEnvironmentUtil.PortConfig.secondary(AzureServices.QUEUE_SERVICE));
 
         waitingFor(Wait.forListeningPort());
     }
diff --git 
a/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraLocalContainerInfraService.java
index 7de7030f1dca..90f137c01db3 100644
--- 
a/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraLocalContainerInfraService.java
@@ -60,11 +60,7 @@ public class CassandraLocalContainerInfraService implements 
CassandraInfraServic
             public CassandraContainerWithFixedPort(boolean fixedPort) {
                 
super(DockerImageName.parse(imageName).asCompatibleSubstituteFor("cassandra"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(9042, 9042);
-                } else {
-                    withExposedPorts(9042);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 9042);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptLocalContainerInfraService.java
index 48b4c8ed4be3..68fe4fac6d94 100644
--- 
a/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptLocalContainerInfraService.java
@@ -40,15 +40,25 @@ public class ChatScriptLocalContainerInfraService 
implements ChatScriptInfraServ
                 ChatScriptLocalContainerInfraService.class,
                 ChatScriptProperties.CHATSCRIPT_CONTAINER);
 
-        container = new GenericContainer<>(containerName) // NOSONAR
-                .withExposedPorts(SERVICE_PORT)
-                .withCreateContainerCmdModifier(createContainerCmd -> 
createContainerCmd.withTty(true));
+        container = initContainer(containerName);
+
         String name = ContainerEnvironmentUtil.containerName(this.getClass());
         if (name != null) {
             container.withCreateContainerCmdModifier(cmd -> 
cmd.withName(name));
         }
     }
 
+    private GenericContainer<?> initContainer(String containerName) {
+        class ChatScriptContainer extends 
GenericContainer<ChatScriptContainer> {
+            ChatScriptContainer(String imageName, boolean fixedPort) {
+                super(imageName);
+                withCreateContainerCmdModifier(createContainerCmd -> 
createContainerCmd.withTty(true));
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
SERVICE_PORT);
+            }
+        }
+        return new ChatScriptContainer(containerName, 
ContainerEnvironmentUtil.isFixedPort(this.getClass()));
+    }
+
     @Override
     public void registerProperties() {
         System.setProperty(ChatScriptProperties.CHATSCRIPT_ADDRESS, 
serviceAddress());
diff --git 
a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
 
b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
index 0ea8bc109eea..c2ba0b825695 100644
--- 
a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
+++ 
b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
@@ -17,6 +17,8 @@
 
 package org.apache.camel.test.infra.common.services;
 
+import java.lang.reflect.Method;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 
@@ -30,6 +32,7 @@ import org.testcontainers.containers.GenericContainer;
 
 public final class ContainerEnvironmentUtil {
     public static final String STARTUP_ATTEMPTS_PROPERTY = ".startup.attempts";
+    public static final String INFRA_PORT_PROPERTY = "camel.infra.port";
     private static final Logger LOG = 
LoggerFactory.getLogger(ContainerEnvironmentUtil.class);
 
     private static boolean dockerAvailable;
@@ -86,18 +89,23 @@ public final class ContainerEnvironmentUtil {
      * testcontainer isolation).
      *
      * Services implementing an interface with "InfraService" in the name are 
considered to be intended for use with
-     * Camel JBang and will use fixed default ports.
+     * Camel JBang and will use fixed default ports. This checks both direct 
and inherited interfaces.
      *
      * @param  cls the service class to check
      * @return     true if the service should use fixed ports, false for 
random ports
      */
     public static boolean isFixedPort(@SuppressWarnings("rawtypes") Class cls) 
{
-        for (Class<?> i : cls.getInterfaces()) {
-            if (i.getName().contains("InfraService")) {
-                LOG.debug("Service {} will use fixed ports (detected 
InfraService interface: {})",
-                        cls.getSimpleName(), i.getSimpleName());
-                return true;
+        // Check the entire class hierarchy for InfraService interfaces
+        Class<?> currentClass = cls;
+        while (currentClass != null) {
+            for (Class<?> i : currentClass.getInterfaces()) {
+                if (i.getName().contains("InfraService")) {
+                    LOG.debug("Service {} will use fixed ports (detected 
InfraService interface: {})",
+                            cls.getSimpleName(), i.getSimpleName());
+                    return true;
+                }
             }
+            currentClass = currentClass.getSuperclass();
         }
 
         LOG.debug("Service {} will use random ports (no InfraService interface 
detected)", cls.getSimpleName());
@@ -130,4 +138,100 @@ public final class ContainerEnvironmentUtil {
         }
         return annotation;
     }
+
+    /**
+     * Gets the configured port from system property, or returns the default 
port if not set or invalid.
+     *
+     * @param  defaultPort the default port to use if no valid port is 
configured
+     * @return             the configured port or the default port
+     */
+    public static int getConfiguredPort(int defaultPort) {
+        String portStr = System.getProperty(INFRA_PORT_PROPERTY);
+        if (portStr != null && !portStr.isEmpty()) {
+            try {
+                return Integer.parseInt(portStr);
+            } catch (NumberFormatException e) {
+                LOG.warn("Invalid port value '{}', using default: {}", 
portStr, defaultPort);
+            }
+        }
+        return defaultPort;
+    }
+
+    /**
+     * Configures port exposure for a single-port container based on 
fixed/random port mode.
+     *
+     * @param container   the container to configure
+     * @param fixedPort   true to use fixed ports, false for random ports
+     * @param defaultPort the default container port
+     */
+    public static void configurePort(GenericContainer<?> container, boolean 
fixedPort, int defaultPort) {
+        configurePorts(container, fixedPort, PortConfig.primary(defaultPort));
+    }
+
+    /**
+     * Configures port exposure for a container based on fixed/random port 
mode. Primary port uses configured value from
+     * system property; secondary ports use defaults.
+     *
+     * @param container the container to configure
+     * @param fixedPort true to use fixed ports, false for random ports
+     * @param ports     the port configurations (primary and secondary)
+     */
+    public static void configurePorts(GenericContainer<?> container, boolean 
fixedPort, PortConfig... ports) {
+        if (fixedPort) {
+            for (PortConfig port : ports) {
+                int hostPort = port.primary() ? 
getConfiguredPort(port.containerPort()) : port.containerPort();
+                addFixedExposedPort(container, hostPort, port.containerPort());
+            }
+        } else {
+            Integer[] containerPorts = Arrays.stream(ports)
+                    .map(PortConfig::containerPort)
+                    .toArray(Integer[]::new);
+            container.withExposedPorts(containerPorts);
+        }
+    }
+
+    /**
+     * Invokes the protected addFixedExposedPort method on a container using 
reflection.
+     *
+     * @param container     the container to configure
+     * @param hostPort      the host port to bind
+     * @param containerPort the container port to expose
+     */
+    private static void addFixedExposedPort(GenericContainer<?> container, int 
hostPort, int containerPort) {
+        try {
+            Method method = 
GenericContainer.class.getDeclaredMethod("addFixedExposedPort", int.class, 
int.class);
+            method.setAccessible(true);
+            method.invoke(container, hostPort, containerPort);
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to add fixed exposed port " + 
hostPort + " -> " + containerPort, e);
+        }
+    }
+
+    /**
+     * Configuration for a container port, indicating whether it's the primary 
port or a secondary port.
+     *
+     * @param containerPort the container port number
+     * @param primary       true if this is the primary port (uses configured 
port from system property)
+     */
+    public record PortConfig(int containerPort, boolean primary) {
+        /**
+         * Creates a primary port configuration. The host port will be read 
from system property if configured.
+         *
+         * @param  port the container port
+         * @return      a primary port configuration
+         */
+        public static PortConfig primary(int port) {
+            return new PortConfig(port, true);
+        }
+
+        /**
+         * Creates a secondary port configuration. The host port will use the 
same value as container port.
+         *
+         * @param  port the container port
+         * @return      a secondary port configuration
+         */
+        public static PortConfig secondary(int port) {
+            return new PortConfig(port, false);
+        }
+    }
 }
diff --git 
a/test-infra/camel-test-infra-couchbase/src/main/java/org/apache/camel/test/infra/couchbase/services/CouchbaseLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-couchbase/src/main/java/org/apache/camel/test/infra/couchbase/services/CouchbaseLocalContainerInfraService.java
index 5a7159d650ab..2572c6492484 100644
--- 
a/test-infra/camel-test-infra-couchbase/src/main/java/org/apache/camel/test/infra/couchbase/services/CouchbaseLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-couchbase/src/main/java/org/apache/camel/test/infra/couchbase/services/CouchbaseLocalContainerInfraService.java
@@ -51,19 +51,16 @@ public class CouchbaseLocalContainerInfraService implements 
CouchbaseInfraServic
             
super(DockerImageName.parse(imageName).asCompatibleSubstituteFor("couchbase/server"));
 
             final int kvPort = 11210;
-            addFixedExposedPort(kvPort, kvPort);
-
             final int managementPort = 8091;
-            addFixedExposedPort(managementPort, managementPort);
-
             final int viewPort = 8092;
-            addFixedExposedPort(viewPort, viewPort);
-
             final int queryPort = 8093;
-            addFixedExposedPort(queryPort, queryPort);
-
             final int searchPort = 8094;
-            addFixedExposedPort(searchPort, searchPort);
+            ContainerEnvironmentUtil.configurePorts(this, true,
+                    ContainerEnvironmentUtil.PortConfig.primary(kvPort),
+                    
ContainerEnvironmentUtil.PortConfig.secondary(managementPort),
+                    ContainerEnvironmentUtil.PortConfig.secondary(viewPort),
+                    ContainerEnvironmentUtil.PortConfig.secondary(queryPort),
+                    ContainerEnvironmentUtil.PortConfig.secondary(searchPort));
         }
     }
 
diff --git 
a/test-infra/camel-test-infra-couchdb/src/main/java/org/apache/camel/test/infra/couchdb/services/CouchDbLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-couchdb/src/main/java/org/apache/camel/test/infra/couchdb/services/CouchDbLocalContainerInfraService.java
index 2d9767e1ea37..d093331a12ac 100644
--- 
a/test-infra/camel-test-infra-couchdb/src/main/java/org/apache/camel/test/infra/couchdb/services/CouchDbLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-couchdb/src/main/java/org/apache/camel/test/infra/couchdb/services/CouchDbLocalContainerInfraService.java
@@ -64,11 +64,7 @@ public class CouchDbLocalContainerInfraService implements 
CouchDbInfraService, C
                 withEnv("COUCHDB_PASSWORD", "password");
                 waitingFor(Wait.forListeningPort());
 
-                if (fixedPort) {
-                    addFixedExposedPort(CouchDbProperties.DEFAULT_PORT, 
CouchDbProperties.DEFAULT_PORT);
-                } else {
-                    withExposedPorts(CouchDbProperties.DEFAULT_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
CouchDbProperties.DEFAULT_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingLocalContainerInfraService.java
index dd80626f6456..14f84d1e5c07 100644
--- 
a/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingLocalContainerInfraService.java
@@ -65,13 +65,10 @@ public class DoclingLocalContainerInfraService implements 
DoclingInfraService, C
             public TestInfraDoclingContainer(boolean fixedPort) {
                 super(DockerImageName.parse(doclingImage));
 
-                withExposedPorts(DOCLING_PORT)
-                        .waitingFor(Wait.forListeningPorts(DOCLING_PORT))
+                waitingFor(Wait.forListeningPorts(DOCLING_PORT))
                         .withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(DOCLING_PORT, DOCLING_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
DOCLING_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-elasticsearch/src/main/java/org/apache/camel/test/infra/elasticsearch/services/ElasticSearchLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-elasticsearch/src/main/java/org/apache/camel/test/infra/elasticsearch/services/ElasticSearchLocalContainerInfraService.java
index b3ea47c02c57..abe0f4163e39 100644
--- 
a/test-infra/camel-test-infra-elasticsearch/src/main/java/org/apache/camel/test/infra/elasticsearch/services/ElasticSearchLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-elasticsearch/src/main/java/org/apache/camel/test/infra/elasticsearch/services/ElasticSearchLocalContainerInfraService.java
@@ -77,11 +77,7 @@ public class ElasticSearchLocalContainerInfraService
 
                 withPassword(PASSWORD);
 
-                if (fixedPort) {
-                    addFixedExposedPort(ELASTIC_SEARCH_PORT, 
ELASTIC_SEARCH_PORT);
-                } else {
-                    withExposedPorts(ELASTIC_SEARCH_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
ELASTIC_SEARCH_PORT);
 
                 setWaitStrategy(
                         new LogMessageWaitStrategy()
diff --git 
a/test-infra/camel-test-infra-fhir/src/main/java/org/apache/camel/test/infra/fhir/services/FhirLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-fhir/src/main/java/org/apache/camel/test/infra/fhir/services/FhirLocalContainerInfraService.java
index 0c786ad35103..2bd46e2094b4 100644
--- 
a/test-infra/camel-test-infra-fhir/src/main/java/org/apache/camel/test/infra/fhir/services/FhirLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-fhir/src/main/java/org/apache/camel/test/infra/fhir/services/FhirLocalContainerInfraService.java
@@ -62,11 +62,7 @@ public class FhirLocalContainerInfraService implements 
FhirInfraService, Contain
             public FhirContainer(boolean fixedPort) {
                 super(imageName);
                 withNetworkAliases(containerName);
-                if (fixedPort) {
-                    addFixedExposedPort(FhirProperties.DEFAULT_SERVICE_PORT, 
FhirProperties.DEFAULT_SERVICE_PORT);
-                } else {
-                    withExposedPorts(FhirProperties.DEFAULT_SERVICE_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
FhirProperties.DEFAULT_SERVICE_PORT);
                 withStartupTimeout(Duration.ofMinutes(3L));
                 withStartupAttempts(5);
                 withEnv("hapi.fhir.allow_multiple_delete", "true");
diff --git 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpEmbeddedInfraService.java
 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpEmbeddedInfraService.java
index 4a0bab17ab0d..1576ffb6a35b 100644
--- 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpEmbeddedInfraService.java
+++ 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpEmbeddedInfraService.java
@@ -134,7 +134,7 @@ public class FtpEmbeddedInfraService extends 
AbstractService implements FtpInfra
 
         ListenerFactory factory = new ListenerFactory();
         if (ContainerEnvironmentUtil.isFixedPort(this.getClass())) {
-            factory.setPort(2221);
+            factory.setPort(ContainerEnvironmentUtil.getConfiguredPort(2221));
         } else {
             factory.setPort(port);
         }
diff --git 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpsEmbeddedInfraService.java
 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpsEmbeddedInfraService.java
index f9fb40d06057..a1a442d4aa2f 100644
--- 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpsEmbeddedInfraService.java
+++ 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/FtpsEmbeddedInfraService.java
@@ -25,6 +25,7 @@ import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
 
 import org.apache.camel.spi.annotations.InfraService;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.ftp.services.FtpInfraService;
 import org.apache.ftpserver.FtpServerFactory;
 import org.apache.ftpserver.listener.ListenerFactory;
@@ -62,7 +63,11 @@ public class FtpsEmbeddedInfraService extends 
FtpEmbeddedInfraService {
         FtpServerFactory serverFactory = 
super.createFtpServerFactory(embeddedConfiguration);
 
         ListenerFactory listenerFactory = new 
ListenerFactory(serverFactory.getListener(DEFAULT_LISTENER));
-        listenerFactory.setPort(port);
+        if (ContainerEnvironmentUtil.isFixedPort(this.getClass())) {
+            
listenerFactory.setPort(ContainerEnvironmentUtil.getConfiguredPort(2221));
+        } else {
+            listenerFactory.setPort(port);
+        }
         
listenerFactory.setImplicitSsl(embeddedConfiguration.getSecurityConfiguration().isUseImplicit());
         
listenerFactory.setSslConfiguration(createSslConfiguration(embeddedConfiguration).createSslConfiguration());
 
diff --git 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/SftpEmbeddedInfraService.java
 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/SftpEmbeddedInfraService.java
index dda41be51919..b8050c3c5871 100644
--- 
a/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/SftpEmbeddedInfraService.java
+++ 
b/test-infra/camel-test-infra-ftp/src/main/java/org/apache/camel/test/infra/ftp/services/embedded/SftpEmbeddedInfraService.java
@@ -97,7 +97,7 @@ public class SftpEmbeddedInfraService extends AbstractService 
implements FtpInfr
     public void setUpServer() throws Exception {
         sshd = SshServer.setUpDefaultServer();
         if (ContainerEnvironmentUtil.isFixedPort(this.getClass())) {
-            sshd.setPort(2222);
+            sshd.setPort(ContainerEnvironmentUtil.getConfiguredPort(2222));
         } else {
             sshd.setPort(port);
         }
diff --git 
a/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubLocalContainerInfraService.java
index 413de765afb1..9475b681e329 100644
--- 
a/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubLocalContainerInfraService.java
@@ -67,11 +67,7 @@ public class GooglePubSubLocalContainerInfraService
             public TestInfraPubSubEmulatorContainer(boolean fixedPort) {
                 super(DockerImageName.parse(imageName));
 
-                if (fixedPort) {
-                    addFixedExposedPort(PORT, PORT);
-                } else {
-                    addExposedPort(PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, PORT);
             }
         }
         return new 
TestInfraPubSubEmulatorContainer(ContainerEnvironmentUtil.isFixedPort(this.getClass()));
diff --git 
a/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpVaultLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpVaultLocalContainerInfraService.java
index e565799e7536..358b091eb19e 100644
--- 
a/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpVaultLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpVaultLocalContainerInfraService.java
@@ -92,12 +92,7 @@ public class HashicorpVaultLocalContainerInfraService
                         .waitingFor(Wait.forListeningPort())
                         
.waitingFor(Wait.forLogMessage(".*Development.*mode.*should.*", 1));
 
-                if (fixedPort) {
-                    
addFixedExposedPort(HashicorpVaultProperties.DEFAULT_SERVICE_PORT,
-                            HashicorpVaultProperties.DEFAULT_SERVICE_PORT);
-                } else {
-                    
withExposedPorts(HashicorpVaultProperties.DEFAULT_SERVICE_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
HashicorpVaultProperties.DEFAULT_SERVICE_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-hivemq/src/main/java/org/apache/camel/test/infra/hivemq/services/LocalHiveMQSparkplugTCKInfraService.java
 
b/test-infra/camel-test-infra-hivemq/src/main/java/org/apache/camel/test/infra/hivemq/services/LocalHiveMQSparkplugTCKInfraService.java
index f00eae2e4c9b..7d201ba05a68 100644
--- 
a/test-infra/camel-test-infra-hivemq/src/main/java/org/apache/camel/test/infra/hivemq/services/LocalHiveMQSparkplugTCKInfraService.java
+++ 
b/test-infra/camel-test-infra-hivemq/src/main/java/org/apache/camel/test/infra/hivemq/services/LocalHiveMQSparkplugTCKInfraService.java
@@ -49,11 +49,7 @@ public class LocalHiveMQSparkplugTCKInfraService extends 
AbstractLocalHiveMQServ
                 super(DockerImageName.parse(newImageName)
                         .asCompatibleSubstituteFor("hivemq/hivemq-ce"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(1883, 1883);
-                } else {
-                    addExposedPort(1883);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 1883);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQLocalContainerInfraService.java
index c7cd13c60f4a..dc52eff8bbd4 100644
--- 
a/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQLocalContainerInfraService.java
@@ -18,6 +18,7 @@ package org.apache.camel.test.infra.ibmmq.services;
 
 import org.apache.camel.spi.annotations.InfraService;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.common.services.ContainerService;
 import org.apache.camel.test.infra.ibmmq.common.IbmMQProperties;
 import org.slf4j.Logger;
@@ -62,8 +63,10 @@ public class IbmMQLocalContainerInfraService implements 
IbmMQInfraService, Conta
                         .waitingFor(Wait.forLogMessage(
                                 ".*Queued Publish/Subscribe Daemon started for 
queue manager.*", 1));
 
-                addFixedExposedPort(MQ_LISTENER_PORT, MQ_LISTENER_PORT);
-                addFixedExposedPort(WEB_CONSOLE_PORT, WEB_CONSOLE_PORT);
+                ContainerEnvironmentUtil.configurePorts(this,
+                        
ContainerEnvironmentUtil.isFixedPort(IbmMQLocalContainerInfraService.class),
+                        
ContainerEnvironmentUtil.PortConfig.primary(MQ_LISTENER_PORT),
+                        
ContainerEnvironmentUtil.PortConfig.secondary(WEB_CONSOLE_PORT));
             }
         }
         return new IbmMQContainer();
@@ -112,6 +115,6 @@ public class IbmMQLocalContainerInfraService implements 
IbmMQInfraService, Conta
 
     @Override
     public int listenerPort() {
-        return MQ_LISTENER_PORT;
+        return container.getMappedPort(MQ_LISTENER_PORT);
     }
 }
diff --git 
a/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyContainer.java
 
b/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyContainer.java
index 39c201716210..bf641dd71144 100644
--- 
a/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyContainer.java
+++ 
b/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyContainer.java
@@ -20,6 +20,7 @@ package org.apache.camel.test.infra.iggy.services;
 import java.util.List;
 
 import com.github.dockerjava.api.model.Ulimit;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.iggy.common.IggyProperties;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
@@ -51,12 +52,10 @@ public class IggyContainer extends 
GenericContainer<IggyContainer> {
                             .withUlimits(List.of(new Ulimit("memlock", -1, 
-1)));
                 });
 
-                if (fixedPort) {
-                    addFixedExposedPort(IggyProperties.DEFAULT_TCP_PORT, 
IggyProperties.DEFAULT_TCP_PORT);
-                } else {
-                    withNetworkAliases(networkAlias)
-                            .withExposedPorts(IggyProperties.DEFAULT_TCP_PORT);
+                if (!fixedPort) {
+                    withNetworkAliases(networkAlias);
                 }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
IggyProperties.DEFAULT_TCP_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-infinispan/src/main/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-infinispan/src/main/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerInfraService.java
index 8f889f83babb..6de731d8305d 100644
--- 
a/test-infra/camel-test-infra-infinispan/src/main/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-infinispan/src/main/java/org/apache/camel/test/infra/infinispan/services/InfinispanLocalContainerInfraService.java
@@ -81,11 +81,11 @@ public class InfinispanLocalContainerInfraService 
implements InfinispanInfraServ
 
                 if (isNetworkHost) {
                     withNetworkMode("host");
-                } else if (fixedPort) {
-                    
addFixedExposedPort(InfinispanProperties.DEFAULT_SERVICE_PORT, 
InfinispanProperties.DEFAULT_SERVICE_PORT);
                 } else {
-                    withExposedPorts(InfinispanProperties.DEFAULT_SERVICE_PORT)
-                            .waitingFor(Wait.forListeningPort());
+                    ContainerEnvironmentUtil.configurePort(this, fixedPort, 
InfinispanProperties.DEFAULT_SERVICE_PORT);
+                    if (!fixedPort) {
+                        waitingFor(Wait.forListeningPort());
+                    }
                 }
             }
         }
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentContainer.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentContainer.java
index 42d60218c537..95aa14e095fc 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentContainer.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentContainer.java
@@ -21,6 +21,7 @@ import java.util.UUID;
 
 import com.github.dockerjava.api.command.CreateContainerCmd;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.kafka.common.KafkaProperties;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.Network;
@@ -85,7 +86,7 @@ public class ConfluentContainer extends 
GenericContainer<ConfluentContainer> {
 
     @Override
     public void start() {
-        addFixedExposedPort(KAFKA_PORT, KAFKA_PORT);
+        ContainerEnvironmentUtil.configurePort(this, true, KAFKA_PORT);
         super.start();
     }
 }
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentInfraService.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentInfraService.java
index 49c765a1a5d7..93c95805f865 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentInfraService.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ConfluentInfraService.java
@@ -52,9 +52,7 @@ public class ConfluentInfraService implements 
KafkaInfraService, ContainerServic
             public TestInfraConfluentContainer(Network network, String name, 
boolean fixedPort) {
                 super(network, name);
 
-                if (fixedPort) {
-                    addFixedExposedPort(9092, 9092);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 9092);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaInfraService.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaInfraService.java
index f9abeb77ef5f..6e7dfe7c3e0a 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaInfraService.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaInfraService.java
@@ -60,10 +60,7 @@ public class ContainerLocalKafkaInfraService implements 
KafkaInfraService, Conta
                 
super(DockerImageName.parse(System.getProperty(KafkaProperties.KAFKA_CONTAINER, 
KAFKA3_IMAGE_NAME))
                         .asCompatibleSubstituteFor("apache/kafka"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(9092, 9092);
-                }
-                // For random ports, testcontainers will handle port mapping 
automatically
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 9092);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/RedpandaInfraService.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/RedpandaInfraService.java
index 773790041dc5..301791202efc 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/RedpandaInfraService.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/RedpandaInfraService.java
@@ -57,9 +57,7 @@ public class RedpandaInfraService implements 
KafkaInfraService, ContainerService
             public TestInfraRedpandaContainer(boolean fixedPort) {
                 super(RedpandaTransactionsEnabledContainer.REDPANDA_CONTAINER);
 
-                if (fixedPort) {
-                    addFixedExposedPort(9092, 9092);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 9092);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziContainer.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziContainer.java
index a0f7036ac208..ec95be605218 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziContainer.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziContainer.java
@@ -19,6 +19,7 @@ package org.apache.camel.test.infra.kafka.services;
 
 import com.github.dockerjava.api.command.CreateContainerCmd;
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.kafka.common.KafkaProperties;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.Network;
@@ -62,7 +63,7 @@ public class StrimziContainer extends 
GenericContainer<StrimziContainer> {
 
     @Override
     public void start() {
-        addFixedExposedPort(KAFKA_PORT, KAFKA_PORT);
+        ContainerEnvironmentUtil.configurePort(this, true, KAFKA_PORT);
         super.start();
     }
 }
diff --git 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziInfraService.java
 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziInfraService.java
index 1dca08f18617..6896668eea1e 100644
--- 
a/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziInfraService.java
+++ 
b/test-infra/camel-test-infra-kafka/src/main/java/org/apache/camel/test/infra/kafka/services/StrimziInfraService.java
@@ -61,9 +61,7 @@ public class StrimziInfraService implements 
KafkaInfraService, ContainerService<
             public TestInfraStrimziContainer(Network network, String name, 
String zookeeperInstanceName, boolean fixedPort) {
                 super(network, name, zookeeperInstanceName);
 
-                if (fixedPort) {
-                    addFixedExposedPort(9092, 9092);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 9092);
             }
         }
 
@@ -76,9 +74,7 @@ public class StrimziInfraService implements 
KafkaInfraService, ContainerService<
             public TestInfraZookeeperContainer(Network network, String name, 
boolean fixedPort) {
                 super(network, name);
 
-                if (fixedPort) {
-                    addFixedExposedPort(2181, 2181);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 2181);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalAuthKafkaService.java
 
b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalAuthKafkaService.java
index af0514f9298e..d8b57108b69b 100644
--- 
a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalAuthKafkaService.java
+++ 
b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalAuthKafkaService.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.test.infra.kafka.services;
 
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.common.services.ContainerService;
 import org.apache.camel.test.infra.kafka.common.KafkaProperties;
 import org.slf4j.Logger;
@@ -50,7 +51,7 @@ public class ContainerLocalAuthKafkaService implements 
KafkaService, ContainerSe
         public StaticKafkaContainer(String jaasConfigFile) {
             super(jaasConfigFile);
 
-            addFixedExposedPort(9093, 9093);
+            ContainerEnvironmentUtil.configurePort(this, true, 9093);
         }
 
         @Override
diff --git 
a/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakLocalContainerInfraService.java
index de4fdc02c2ee..f2d67a9963ac 100644
--- 
a/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakLocalContainerInfraService.java
@@ -79,16 +79,13 @@ public class KeycloakLocalContainerInfraService implements 
KeycloakInfraService,
                     startCommand = "start-dev";
                 }
 
-                withExposedPorts(KEYCLOAK_PORT)
-                        .withEnv("KEYCLOAK_ADMIN", DEFAULT_ADMIN_USERNAME)
+                withEnv("KEYCLOAK_ADMIN", DEFAULT_ADMIN_USERNAME)
                         .withEnv("KEYCLOAK_ADMIN_PASSWORD", 
DEFAULT_ADMIN_PASSWORD)
                         .withCommand(startCommand.split(" "))
                         .waitingFor(Wait.forListeningPorts(KEYCLOAK_PORT))
                         .withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(KEYCLOAK_PORT, KEYCLOAK_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
KEYCLOAK_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
 
b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
index 527cb7fcdcc7..c371e3bc1b63 100644
--- 
a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
@@ -67,11 +67,7 @@ public class MicroprofileLRALocalContainerInfraService
                         .waitingFor(Wait.forListeningPort())
                         
.waitingFor(Wait.forLogMessage(".*lra-coordinator-quarkus.*Listening on.*", 1));
 
-                if (fixedPort) {
-                    
addFixedExposedPort(MicroprofileLRAProperties.DEFAULT_PORT, 
MicroprofileLRAProperties.DEFAULT_PORT);
-                } else {
-                    withExposedPorts(MicroprofileLRAProperties.DEFAULT_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
MicroprofileLRAProperties.DEFAULT_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-milvus/src/main/java/org/apache/camel/test/infra/milvus/services/MilvusLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-milvus/src/main/java/org/apache/camel/test/infra/milvus/services/MilvusLocalContainerInfraService.java
index 63a18b5046db..7d8905b22feb 100644
--- 
a/test-infra/camel-test-infra-milvus/src/main/java/org/apache/camel/test/infra/milvus/services/MilvusLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-milvus/src/main/java/org/apache/camel/test/infra/milvus/services/MilvusLocalContainerInfraService.java
@@ -62,10 +62,9 @@ public class MilvusLocalContainerInfraService implements 
MilvusInfraService, Con
                 
super(DockerImageName.parse(imageName).asCompatibleSubstituteFor("milvusdb/milvus"));
                 withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(9091, 9091);
-                    addFixedExposedPort(19530, 19530);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(19530),
+                        ContainerEnvironmentUtil.PortConfig.secondary(9091));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerInfraService.java
index e86fa206a2b2..92d3d5df7d17 100644
--- 
a/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerInfraService.java
@@ -74,13 +74,14 @@ public class MinioLocalContainerInfraService implements 
MinioInfraService, Conta
                                 .withStartupTimeout(Duration.ofSeconds(10)));
 
                 if (fixedPort) {
-                    addFixedExposedPort(MINIO_TCP_PORT, MINIO_TCP_PORT);
-                    addFixedExposedPort(MINIO_UI_PORT, MINIO_UI_PORT);
+                    ContainerEnvironmentUtil.configurePorts(this, true,
+                            
ContainerEnvironmentUtil.PortConfig.primary(MINIO_TCP_PORT),
+                            
ContainerEnvironmentUtil.PortConfig.secondary(MINIO_UI_PORT));
                     withCommand("server /data --console-address :9001");
                     withEnv("MINIO_ROOT_USER", USERNAME);
                     withEnv("MINIO_ROOT_PASSWORD", PASSWORD);
                 } else {
-                    withExposedPorts(MINIO_TCP_PORT);
+                    ContainerEnvironmentUtil.configurePort(this, false, 
MINIO_TCP_PORT);
                     withCommand("server /data");
                 }
             }
diff --git 
a/test-infra/camel-test-infra-mongodb/src/main/java/org/apache/camel/test/infra/mongodb/services/MongoDBLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-mongodb/src/main/java/org/apache/camel/test/infra/mongodb/services/MongoDBLocalContainerInfraService.java
index 0ac42a34505f..0bb6636d11a8 100644
--- 
a/test-infra/camel-test-infra-mongodb/src/main/java/org/apache/camel/test/infra/mongodb/services/MongoDBLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-mongodb/src/main/java/org/apache/camel/test/infra/mongodb/services/MongoDBLocalContainerInfraService.java
@@ -57,17 +57,9 @@ public class MongoDBLocalContainerInfraService implements 
MongoDBInfraService, C
 
             public TestInfraMongoDBContainer(boolean fixedPort, String 
imageName) {
                 
super(DockerImageName.parse(imageName).asCompatibleSubstituteFor("mongo"));
-                addPort(fixedPort);
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
DEFAULT_MONGODB_PORT);
                 withReplicaSet();
             }
-
-            private void addPort(boolean fixedPort) {
-                if (fixedPort) {
-                    addFixedExposedPort(27017, 27017);
-                } else {
-                    addExposedPort(27017);
-                }
-            }
         }
         return new 
TestInfraMongoDBContainer(ContainerEnvironmentUtil.isFixedPort(this.getClass()),
 imageName);
     }
diff --git 
a/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoLocalContainerInfraService.java
index 38cb6e791c8b..dcdc72e4b162 100644
--- 
a/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoLocalContainerInfraService.java
@@ -74,8 +74,9 @@ public class MosquittoLocalContainerInfraService implements 
MosquittoInfraServic
                     .withExposedPorts(CONTAINER_PORT);
         } else {
             @SuppressWarnings("deprecation")
+            int configuredPort = 
ContainerEnvironmentUtil.getConfiguredPort(port);
             GenericContainer<?> fixedPortContainer = new 
FixedHostPortGenericContainer<>(imageName) // NOSONAR
-                    .withFixedExposedPort(port, CONTAINER_PORT);
+                    .withFixedExposedPort(configuredPort, CONTAINER_PORT);
             ret = fixedPortContainer;
         }
 
diff --git 
a/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsLocalContainerInfraService.java
index 4217de050369..2158a5aa1759 100644
--- 
a/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsLocalContainerInfraService.java
@@ -56,11 +56,7 @@ public class NatsLocalContainerInfraService implements 
NatsInfraService, Contain
                 withNetworkAliases(containerName)
                         
.waitingFor(Wait.forLogMessage(".*Listening.*for.*route.*connections.*", 1));
 
-                if (fixedPort) {
-                    addFixedExposedPort(PORT, PORT);
-                } else {
-                    withExposedPorts(PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-neo4j/src/main/java/org/apache/camel/test/infra/neo4j/services/Neo4jLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-neo4j/src/main/java/org/apache/camel/test/infra/neo4j/services/Neo4jLocalContainerInfraService.java
index 2048cf7d394f..932d7acf711e 100644
--- 
a/test-infra/camel-test-infra-neo4j/src/main/java/org/apache/camel/test/infra/neo4j/services/Neo4jLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-neo4j/src/main/java/org/apache/camel/test/infra/neo4j/services/Neo4jLocalContainerInfraService.java
@@ -59,11 +59,10 @@ public class Neo4jLocalContainerInfraService implements 
Neo4jInfraService, Conta
                 withStartupTimeout(Duration.ofMinutes(3L));
                 withRandomPassword();
 
-                if (fixedPort) {
-                    addFixedExposedPort(7687, 7687);
-                    addFixedExposedPort(7473, 7473);
-                    addFixedExposedPort(7474, 7474);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(7687),
+                        ContainerEnvironmentUtil.PortConfig.secondary(7473),
+                        ContainerEnvironmentUtil.PortConfig.secondary(7474));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-ollama/src/main/java/org/apache/camel/test/infra/ollama/services/OllamaLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-ollama/src/main/java/org/apache/camel/test/infra/ollama/services/OllamaLocalContainerInfraService.java
index 6adef64f8e5c..e64d24a980fd 100644
--- 
a/test-infra/camel-test-infra-ollama/src/main/java/org/apache/camel/test/infra/ollama/services/OllamaLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-ollama/src/main/java/org/apache/camel/test/infra/ollama/services/OllamaLocalContainerInfraService.java
@@ -109,9 +109,7 @@ public class OllamaLocalContainerInfraService implements 
OllamaInfraService, Con
                     LOG.info("GPU support disabled");
                 }
 
-                if (fixedPort) {
-                    addFixedExposedPort(11434, 11434);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 11434);
                 String name = 
ContainerEnvironmentUtil.containerName(OllamaLocalContainerInfraService.this.getClass());
                 if (name != null) {
                     withCreateContainerCmdModifier(cmd -> cmd.withName(name));
diff --git 
a/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenLdapContainer.java
 
b/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenLdapContainer.java
index 19efa228a32b..eb33dfb86b97 100644
--- 
a/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenLdapContainer.java
+++ 
b/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenLdapContainer.java
@@ -18,6 +18,7 @@
 package org.apache.camel.test.infra.openldap.services;
 
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.openldap.common.OpenldapProperties;
 import org.testcontainers.containers.GenericContainer;
 
@@ -30,12 +31,11 @@ public class OpenLdapContainer extends 
GenericContainer<OpenLdapContainer> {
         
super(LocalPropertyResolver.getProperty(OpenldapLocalContainerInfraService.class,
                 OpenldapProperties.OPENLDAP_CONTAINER));
 
-        if (fixedPort) {
-            this.addFixedExposedPort(CONTAINER_PORT_LDAP, CONTAINER_PORT_LDAP);
-            this.addFixedExposedPort(CONTAINER_PORT_LDAP_OVER_SSL, 
CONTAINER_PORT_LDAP_OVER_SSL);
-        } else {
-            this.withExposedPorts(CONTAINER_PORT_LDAP, 
CONTAINER_PORT_LDAP_OVER_SSL)
-                    .withNetworkAliases(CONTAINER_NAME);
+        if (!fixedPort) {
+            this.withNetworkAliases(CONTAINER_NAME);
         }
+        ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                
ContainerEnvironmentUtil.PortConfig.primary(CONTAINER_PORT_LDAP),
+                
ContainerEnvironmentUtil.PortConfig.secondary(CONTAINER_PORT_LDAP_OVER_SSL));
     }
 }
diff --git 
a/test-infra/camel-test-infra-opensearch/src/main/java/org/apache/camel/test/infra/opensearch/services/OpenSearchLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-opensearch/src/main/java/org/apache/camel/test/infra/opensearch/services/OpenSearchLocalContainerInfraService.java
index 53053f14e2c7..6935d7e35ad1 100644
--- 
a/test-infra/camel-test-infra-opensearch/src/main/java/org/apache/camel/test/infra/opensearch/services/OpenSearchLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-opensearch/src/main/java/org/apache/camel/test/infra/opensearch/services/OpenSearchLocalContainerInfraService.java
@@ -66,9 +66,7 @@ public class OpenSearchLocalContainerInfraService implements 
OpenSearchInfraServ
 
                 withLogConsumer(new Slf4jLogConsumer(LOG));
 
-                if (fixedPort) {
-                    addFixedExposedPort(OPEN_SEARCH_PORT, OPEN_SEARCH_PORT);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 
OPEN_SEARCH_PORT);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeIndexContainer.java
 
b/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeIndexContainer.java
index 40f96c066d6a..c11633ad1140 100644
--- 
a/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeIndexContainer.java
+++ 
b/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeIndexContainer.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.test.infra.pinecone.services;
 
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.GenericContainer;
@@ -43,11 +44,7 @@ public class PineconeIndexContainer extends 
GenericContainer<PineconeIndexContai
         withEnv("INDEX_TYPE", "serverless");
         withEnv("METRIC", "cosine");
         withEnv("PORT", String.valueOf(CLIENT_PORT));
-        if (fixedPort) {
-            addFixedExposedPort(CLIENT_PORT, CLIENT_PORT);
-        } else {
-            withExposedPorts(CLIENT_PORT);
-        }
+        ContainerEnvironmentUtil.configurePort(this, fixedPort, CLIENT_PORT);
     }
 
     public String getEndpoint() {
diff --git 
a/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeLocalContainerInfraService.java
index d55ac3d8bd16..cd3eb64ffce8 100644
--- 
a/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-pinecone/src/main/java/org/apache/camel/test/infra/pinecone/services/PineconeLocalContainerInfraService.java
@@ -61,9 +61,7 @@ public class PineconeLocalContainerInfraService implements 
PineconeInfraService,
 
                 withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(5080, 5080);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 5080);
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
index d64e5f4839f0..4e98792669e1 100644
--- 
a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
@@ -60,9 +60,7 @@ public class PostgresLocalContainerInfraService implements 
PostgresInfraService,
                 super(DockerImageName.parse(imageName)
                         .asCompatibleSubstituteFor("postgres"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(5432, 5432);
-                }
+                ContainerEnvironmentUtil.configurePort(this, fixedPort, 5432);
                 withLogConsumer(new Slf4jLogConsumer(LOG));
             }
         }
diff --git 
a/test-infra/camel-test-infra-pulsar/src/main/java/org/apache/camel/test/infra/pulsar/services/PulsarLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-pulsar/src/main/java/org/apache/camel/test/infra/pulsar/services/PulsarLocalContainerInfraService.java
index dcc74082e6ad..5655f17fdb3a 100644
--- 
a/test-infra/camel-test-infra-pulsar/src/main/java/org/apache/camel/test/infra/pulsar/services/PulsarLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-pulsar/src/main/java/org/apache/camel/test/infra/pulsar/services/PulsarLocalContainerInfraService.java
@@ -61,10 +61,9 @@ public class PulsarLocalContainerInfraService implements 
PulsarInfraService, Con
 
                 withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(6650, 6650);
-                    addFixedExposedPort(8085, 8080);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(6650),
+                        ContainerEnvironmentUtil.PortConfig.secondary(8080));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-qdrant/src/main/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-qdrant/src/main/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerInfraService.java
index c9715c5d754d..fb93601dffb4 100644
--- 
a/test-infra/camel-test-infra-qdrant/src/main/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-qdrant/src/main/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerInfraService.java
@@ -60,10 +60,9 @@ public class QdrantLocalContainerInfraService implements 
QdrantInfraService, Con
                 super(DockerImageName.parse(imageName)
                         .asCompatibleSubstituteFor("qdrant/qdrant"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(6333, 6333);
-                    addFixedExposedPort(6334, 6334);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(HTTP_PORT),
+                        
ContainerEnvironmentUtil.PortConfig.secondary(GRPC_PORT));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQLocalContainerInfraService.java
index a9e8e197f316..01c543c241d8 100644
--- 
a/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQLocalContainerInfraService.java
@@ -57,12 +57,11 @@ public class RabbitMQLocalContainerInfraService implements 
RabbitMQInfraService,
             public TestInfraRabbitMQContainer(boolean fixedPort) {
                 
super(DockerImageName.parse(imageName).asCompatibleSubstituteFor("rabbitmq"));
 
-                if (fixedPort) {
-                    addFixedExposedPort(5672, 5672);
-                    addFixedExposedPort(5671, 5671);
-                    addFixedExposedPort(15671, 15671);
-                    addFixedExposedPort(15672, 15672);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(5672),
+                        ContainerEnvironmentUtil.PortConfig.secondary(5671),
+                        ContainerEnvironmentUtil.PortConfig.secondary(15671),
+                        ContainerEnvironmentUtil.PortConfig.secondary(15672));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisContainer.java
 
b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisContainer.java
index dc7301846002..4c5366c713c3 100644
--- 
a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisContainer.java
+++ 
b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisContainer.java
@@ -18,6 +18,7 @@
 package org.apache.camel.test.infra.redis.services;
 
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.redis.common.RedisProperties;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
@@ -38,12 +39,18 @@ public class RedisContainer extends 
GenericContainer<RedisContainer> {
         super(DockerImageName.parse(imageName));
     }
 
+    public RedisContainer withFixedPort(int hostPort, int containerPort) {
+        addFixedExposedPort(hostPort, containerPort);
+        return this;
+    }
+
     @SuppressWarnings("resource")
     // NOTE: the object must be closed by the client.
     public static RedisContainer initContainer(String imageName, String 
networkAlias, boolean fixedPort) {
-        return new RedisContainer(imageName) // NOSONAR
+        RedisContainer container = new RedisContainer(imageName) // NOSONAR
                 .withNetworkAliases(networkAlias)
-                .withExposedPorts(RedisProperties.DEFAULT_PORT)
                 .waitingFor(Wait.forListeningPort());
+        ContainerEnvironmentUtil.configurePort(container, fixedPort, 
RedisProperties.DEFAULT_PORT);
+        return container;
     }
 }
diff --git 
a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisLocalContainerInfraService.java
index 6b10b74d4dfb..89820a7a3dcf 100644
--- 
a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisLocalContainerInfraService.java
@@ -32,13 +32,22 @@ public class RedisLocalContainerInfraService implements 
RedisInfraService, Conta
     private final RedisContainer container;
 
     public RedisLocalContainerInfraService() {
-        container = new RedisContainer();
+        container = initContainer();
         String name = ContainerEnvironmentUtil.containerName(this.getClass());
         if (name != null) {
             container.withCreateContainerCmdModifier(cmd -> 
cmd.withName(name));
         }
     }
 
+    private RedisContainer initContainer() {
+        RedisContainer container = new RedisContainer();
+        if (ContainerEnvironmentUtil.isFixedPort(this.getClass())) {
+            int port = 
ContainerEnvironmentUtil.getConfiguredPort(RedisProperties.DEFAULT_PORT);
+            container.withFixedPort(port, RedisProperties.DEFAULT_PORT);
+        }
+        return container;
+    }
+
     public RedisLocalContainerInfraService(String imageName) {
         container = RedisContainer.initContainer(imageName, 
RedisContainer.CONTAINER_NAME,
                 ContainerEnvironmentUtil.isFixedPort(this.getClass()));
diff --git 
a/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQBrokerContainer.java
 
b/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQBrokerContainer.java
index 6ede4e105a67..482c07eb6498 100644
--- 
a/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQBrokerContainer.java
+++ 
b/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQBrokerContainer.java
@@ -18,6 +18,7 @@ package org.apache.camel.test.infra.rocketmq.services;
 
 import java.util.Collections;
 
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.rocketmq.common.RocketMQProperties;
 import org.testcontainers.containers.BindMode;
 import org.testcontainers.containers.GenericContainer;
@@ -29,16 +30,13 @@ public class RocketMQBrokerContainer extends 
GenericContainer<RocketMQBrokerCont
     public RocketMQBrokerContainer(Network network, String confName, boolean 
fixedPort) {
         super(RocketMQContainerInfraService.ROCKETMQ_IMAGE);
 
-        if (fixedPort) {
-            addFixedExposedPort(RocketMQProperties.ROCKETMQ_BROKER3_PORT, 
RocketMQProperties.ROCKETMQ_BROKER3_PORT);
-            addFixedExposedPort(RocketMQProperties.ROCKETMQ_BROKER2_PORT, 
RocketMQProperties.ROCKETMQ_BROKER2_PORT);
-            addFixedExposedPort(RocketMQProperties.ROCKETMQ_BROKER1_PORT, 
RocketMQProperties.ROCKETMQ_BROKER1_PORT);
-        } else {
+        if (!fixedPort) {
             withNetwork(network);
-            withExposedPorts(RocketMQProperties.ROCKETMQ_BROKER3_PORT,
-                    RocketMQProperties.ROCKETMQ_BROKER2_PORT,
-                    RocketMQProperties.ROCKETMQ_BROKER1_PORT);
         }
+        ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                
ContainerEnvironmentUtil.PortConfig.primary(RocketMQProperties.ROCKETMQ_BROKER1_PORT),
+                
ContainerEnvironmentUtil.PortConfig.secondary(RocketMQProperties.ROCKETMQ_BROKER2_PORT),
+                
ContainerEnvironmentUtil.PortConfig.secondary(RocketMQProperties.ROCKETMQ_BROKER3_PORT));
         withEnv("NAMESRV_ADDR", "nameserver:9876");
         withClasspathResourceMapping(confName + "/" + confName + ".conf",
                 "/opt/rocketmq-" + 
RocketMQContainerInfraService.ROCKETMQ_VERSION + "/conf/broker.conf",
diff --git 
a/test-infra/camel-test-infra-smb/src/main/java/org/apache/camel/test/infra/smb/services/SmbContainer.java
 
b/test-infra/camel-test-infra-smb/src/main/java/org/apache/camel/test/infra/smb/services/SmbContainer.java
index bab4257968a9..74a7c0dffe36 100644
--- 
a/test-infra/camel-test-infra-smb/src/main/java/org/apache/camel/test/infra/smb/services/SmbContainer.java
+++ 
b/test-infra/camel-test-infra-smb/src/main/java/org/apache/camel/test/infra/smb/services/SmbContainer.java
@@ -17,6 +17,7 @@
 
 package org.apache.camel.test.infra.smb.services;
 
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
 import org.testcontainers.images.builder.ImageFromDockerfile;
@@ -33,11 +34,7 @@ public class SmbContainer extends 
GenericContainer<SmbContainer> {
                 .withFileFromClasspath(".",
                         "org/apache/camel/test/infra/smb/services/"));
 
-        if (fixedPort) {
-            addFixedExposedPort(SMB_PORT_DEFAULT, SMB_PORT_DEFAULT);
-        } else {
-            super.withExposedPorts(SMB_PORT_DEFAULT);
-        }
+        ContainerEnvironmentUtil.configurePort(this, fixedPort, 
SMB_PORT_DEFAULT);
 
         waitingFor(Wait.forListeningPort());
     }
diff --git 
a/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrContainer.java
 
b/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrContainer.java
index c22f200fc1e1..b2b932007287 100644
--- 
a/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrContainer.java
+++ 
b/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrContainer.java
@@ -18,6 +18,7 @@
 package org.apache.camel.test.infra.solr.services;
 
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.solr.common.SolrProperties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,11 +61,7 @@ public class SolrContainer extends 
GenericContainer<SolrContainer> {
                 .withCommand(SOLR_CONTAINER_COMMANDS)
                 .waitingFor(Wait.forHttp("/solr/" + SOLR_DFT_COLLECTION + 
"/admin/ping?docker-ping"));
 
-        if (fixedPort) {
-            solrContainer.addFixedExposedPort(SolrProperties.DEFAULT_PORT, 
SolrProperties.DEFAULT_PORT);
-        } else {
-            solrContainer.withExposedPorts(SolrProperties.DEFAULT_PORT);
-        }
+        ContainerEnvironmentUtil.configurePort(solrContainer, fixedPort, 
SolrProperties.DEFAULT_PORT);
 
         return solrContainer;
     }
diff --git 
a/test-infra/camel-test-infra-torchserve/src/main/java/org/apache/camel/test/infra/torchserve/services/TorchServeLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-torchserve/src/main/java/org/apache/camel/test/infra/torchserve/services/TorchServeLocalContainerInfraService.java
index 7c9b9c738f43..bc4e35a48eb5 100644
--- 
a/test-infra/camel-test-infra-torchserve/src/main/java/org/apache/camel/test/infra/torchserve/services/TorchServeLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-torchserve/src/main/java/org/apache/camel/test/infra/torchserve/services/TorchServeLocalContainerInfraService.java
@@ -70,13 +70,10 @@ public class TorchServeLocalContainerInfraService 
implements TorchServeInfraServ
                         .waitingFor(Wait.forListeningPorts(INFERENCE_PORT, 
MANAGEMENT_PORT, METRICS_PORT))
                         .withCommand(CONTAINER_COMMAND);
 
-                if (fixedPort) {
-                    addFixedExposedPort(INFERENCE_PORT, INFERENCE_PORT);
-                    addFixedExposedPort(MANAGEMENT_PORT, MANAGEMENT_PORT);
-                    addFixedExposedPort(METRICS_PORT, METRICS_PORT);
-                } else {
-                    withExposedPorts(INFERENCE_PORT, MANAGEMENT_PORT, 
METRICS_PORT);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        
ContainerEnvironmentUtil.PortConfig.primary(INFERENCE_PORT),
+                        
ContainerEnvironmentUtil.PortConfig.secondary(MANAGEMENT_PORT),
+                        
ContainerEnvironmentUtil.PortConfig.secondary(METRICS_PORT));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-weaviate/src/main/java/org/apache/camel/test/infra/weaviate/services/WeaviateLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-weaviate/src/main/java/org/apache/camel/test/infra/weaviate/services/WeaviateLocalContainerInfraService.java
index 8a6247fc8f02..8284d0cef0ba 100644
--- 
a/test-infra/camel-test-infra-weaviate/src/main/java/org/apache/camel/test/infra/weaviate/services/WeaviateLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-weaviate/src/main/java/org/apache/camel/test/infra/weaviate/services/WeaviateLocalContainerInfraService.java
@@ -61,10 +61,9 @@ public class WeaviateLocalContainerInfraService implements 
WeaviateInfraService,
 
                 withStartupTimeout(Duration.ofMinutes(3L));
 
-                if (fixedPort) {
-                    addFixedExposedPort(8087, 8080);
-                    addFixedExposedPort(50051, 50051);
-                }
+                ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                        ContainerEnvironmentUtil.PortConfig.primary(8080),
+                        ContainerEnvironmentUtil.PortConfig.secondary(50051));
             }
         }
 
diff --git 
a/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServerContainer.java
 
b/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServerContainer.java
index d35233c49692..489b5a631493 100644
--- 
a/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServerContainer.java
+++ 
b/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServerContainer.java
@@ -22,6 +22,7 @@ import java.net.URI;
 import java.net.URL;
 
 import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.apache.camel.test.infra.xmpp.common.XmppProperties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,11 +46,15 @@ public class XmppServerContainer extends 
GenericContainer<XmppServerContainer> {
     }
 
     public XmppServerContainer(boolean fixedPort) {
-        this();
-        if (fixedPort) {
-            addFixedExposedPort(XmppProperties.PORT_DEFAULT, 
XmppProperties.PORT_DEFAULT);
-            addFixedExposedPort(8088, PORT_REST);
-        }
+        super(LocalPropertyResolver.getProperty(XmppServerContainer.class, 
XmppProperties.XMPP_CONTAINER));
+        setWaitStrategy(Wait.forListeningPort());
+        withNetworkAliases(CONTAINER_NAME)
+                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
+                .waitingFor(Wait.forLogMessage(".*Started Application in.*", 
1));
+
+        ContainerEnvironmentUtil.configurePorts(this, fixedPort,
+                
ContainerEnvironmentUtil.PortConfig.primary(XmppProperties.PORT_DEFAULT),
+                ContainerEnvironmentUtil.PortConfig.secondary(PORT_REST));
     }
 
     public String getUrl() {
diff --git 
a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperContainer.java
 
b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperContainer.java
index 02fe5436b444..1fe98abf2132 100644
--- 
a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperContainer.java
+++ 
b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperContainer.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.test.infra.zookeeper.services;
 
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.GenericContainer;
@@ -54,11 +55,7 @@ public class ZooKeeperContainer extends 
GenericContainer<ZooKeeperContainer> {
         withNetworkAliases(name)
                 .withLogConsumer(new Slf4jLogConsumer(LOGGER));
 
-        if (clientPort > 0) {
-            addFixedExposedPort(clientPort, CLIENT_PORT);
-        } else {
-            withExposedPorts(CLIENT_PORT);
-        }
+        ContainerEnvironmentUtil.configurePort(this, clientPort > 0, 
CLIENT_PORT);
     }
 
     public String getConnectionString() {
diff --git 
a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperLocalContainerInfraService.java
index a8bd662849f9..29f9cf31bbab 100644
--- 
a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperLocalContainerInfraService.java
+++ 
b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperLocalContainerInfraService.java
@@ -50,10 +50,13 @@ public class ZooKeeperLocalContainerInfraService implements 
ZooKeeperInfraServic
     }
 
     protected ZooKeeperContainer initContainer(String imageName) {
+        int clientPort = ContainerEnvironmentUtil.isFixedPort(this.getClass())
+                ? ZooKeeperContainer.CLIENT_PORT
+                : -1;
         if (imageName == null) {
-            return new ZooKeeperContainer();
+            return new ZooKeeperContainer(ZooKeeperContainer.CONTAINER_NAME, 
clientPort);
         } else {
-            return new ZooKeeperContainer(imageName);
+            return new ZooKeeperContainer(imageName, clientPort);
         }
     }
 

Reply via email to