intermediateSpring Boot Integration: Dockerizing, PostgreSQL, Redis, Kafka & Microservices

What is the classic Kafka-in-Docker connectivity bug, and how do you fix it?

A broker can be configured to advertise localhost:9092 as its address to clients. Within the broker's own container, that's technically true, but any other container trying to use that advertised address to connect will be pointed back at itself, not the broker — connections fail after an initially successful metadata request. The fix is setting KAFKA_ADVERTISED_LISTENERS to the broker's actual reachable network alias (its Compose/Kubernetes service name), not localhost.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

What is the classic Kafka-in-Docker connectivity bug, and how do you fix it?

Next Step

Continue to What's the difference between Actuator's readiness and liveness probes, and why does the distinction matter?← Back to all Docker questions