title: cannot setup kafka with docker compose on port other than 9092
body: <p>here is my docker-compose file for Kafka. It is essential to run this on port other than 9092 so that I can have other Kafka instance in docker mapped to 9092. So I decided to go with 9093.</p>
  <pre><code>version: &quot;2&quot;
  
  services:
    kafka_project_zookeeper:
      image: &quot;docker.io/bitnami/zookeeper:3&quot;
      ports:
        - &quot;22181:2181&quot;
      volumes:
        - &quot;kafka_project_zookeeper_data:/bitnami&quot;
      environment:
        ALLOW_ANONYMOUS_LOGIN: &quot;yes&quot;
        ZOOKEEPER_CLIENT_PORT: 2181
        ZOOKEEPER_TICK_TIME: 2000
    kafka_project_dbpostgres:
      image: postgres
      shm_size: 2g
      volumes:
        - /var/lib/kafkaproject_postgresql:/var/lib/postgresql
      ports:
        - &quot;5433:5432&quot;
      environment:
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: postgres
        POSTGRES_DB: kafkaproject
    kafka_project_kafka:
      image: &quot;docker.io/bitnami/kafka:2-debian-10&quot;
      ports:
        - &quot;9093:9092&quot;
      volumes:
        - &quot;kafkaproject_data:/bitnami&quot;
      environment:
        - KAFKA_LISTENERS=PLAINTEXT://:9093
        - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9093
        - KAFKA_ZOOKEEPER_CONNECT=kafka_project_zookeeper:2181
        - ALLOW_PLAINTEXT_LISTENER=yes
      depends_on:
        - kafka_project_zookeeper
  
  volumes:
    kafka_project_zookeeper_data:
      driver: local
    kafkaproject_data:
      driver: local
  </code></pre>
  <p>Problem is that container starts but spring boot app is failed to load topics list and finally app exit:</p>
  <pre><code>2022-04-22 15:27:31.941  INFO 11727 --- [           main] o.a.kafka.common.utils.AppInfoParser     : Kafka version: 3.0.0
  2022-04-22 15:27:31.941  INFO 11727 --- [           main] o.a.kafka.common.utils.AppInfoParser     : Kafka commitId: 8cb0a5e9d3441962
  2022-04-22 15:27:31.941  INFO 11727 --- [           main] o.a.kafka.common.utils.AppInfoParser     : Kafka startTimeMs: 1650634051939
  2022-04-22 15:28:01.948  INFO 11727 --- [| adminclient-1] o.a.k.c.a.i.AdminMetadataManager         : [AdminClient clientId=adminclient-1] Metadata update failed
  
  org.apache.kafka.common.errors.TimeoutException: Timed out waiting to send the call. Call: fetchMetadata
  
  2022-04-22 15:28:01.952 ERROR 11727 --- [           main] o.springframework.kafka.core.KafkaAdmin  : Could not configure topics
  
  org.springframework.kafka.KafkaException: Timed out waiting to get existing topics; nested exception is java.util.concurrent.TimeoutException
      at org.springframework.kafka.core.KafkaAdmin.lambda$checkPartitions$5(KafkaAdmin.java:275) ~[spring-kafka-2.8.1.jar:2.8.1]
      at java.base/java.util.HashMap.forEach(HashMap.java:1337) ~[na:na]
      at org.springframework.kafka.core.KafkaAdmin.checkPartitions(KafkaAdmin.java:254) ~[spring-kafka-2.8.1.jar:2.8.1]
      at org.springframework.kafka.core.KafkaAdmin.addOrModifyTopicsIfNeeded(KafkaAdmin.java:240) ~[spring-kafka-2.8.1.jar:2.8.1]
      at org.springframework.kafka.core.KafkaAdmin.initialize(KafkaAdmin.java:178) ~[spring-kafka-2.8.1.jar:2.8.1]
      at org.springframework.kafka.core.KafkaAdmin.afterSingletonsInstantiated(KafkaAdmin.java:145) ~[spring-kafka-2.8.1.jar:2.8.1]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:972) ~[spring-beans-5.3.14.jar:5.3.14]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.14.jar:5.3.14]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.14.jar:5.3.14]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.2.jar:2.6.2]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.2.jar:2.6.2]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.2.jar:2.6.2]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.2.jar:2.6.2]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.2.jar:2.6.2]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.2.jar:2.6.2]
      at com.mis.kafkademo.KafkademoApplication.main(KafkademoApplication.java:17) ~[main/:na]
  Caused by: java.util.concurrent.TimeoutException: null
      at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1886) ~[na:na]
      at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2021) ~[na:na]
      at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180) ~[kafka-clients-3.0.0.jar:na]
      at org.springframework.kafka.core.KafkaAdmin.lambda$checkPartitions$5(KafkaAdmin.java:257) ~[spring-kafka-2.8.1.jar:2.8.1]
      ... 15 common frames omitted
  
  2022-04-22 15:28:11.953  INFO 11727 --- [| adminclient-1] o.a.k.clients.admin.KafkaAdminClient     : [AdminClient clientId=adminclient-1] Forcing a hard I/O thread shutdown. Requests in progress will be aborted.
  2022-04-22 15:28:11.954  INFO 11727 --- [| adminclient-1] o.a.kafka.common.utils.AppInfoParser     : App info kafka.admin.client for adminclient-1 unregistered
  2022-04-22 15:28:11.954  INFO 11727 --- [| adminclient-1] o.a.k.c.a.i.AdminMetadataManager         : [AdminClient clientId=adminclient-1] Metadata update failed
  </code></pre>