Problem:
Can't connect with Kafka which is running locally in Docker using image https://hub.docker.com/r/bitnami/kafka/.
Getting this error from Spring Boot:
11:29:01.020 [kafka-admin-client-thread | adminclient-1] WARN o.apache.kafka.clients.NetworkClient - [AdminClient clientId=adminclient-1] Error connecting to node 7b125d0acb0d:9092 (id: 1001 rack: null)
java.net.UnknownHostException: 7b125d0acb0d
Where 7b125d0acb0d is the docker container hostname where I'm running Kafka.
Solution:
Specify environment variable:
KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092