0

Can someone point out how to setup kafka with docker? I have tried every tutorial I could find and I got the same error:

Can't resolve YYYYYYY:PORT adress where YYYYYYY is the container id

I tried using kafka listeners, kafka advertised host name, kafka port and kafka advertised listeners enviroment variables but nothing worked. I mapped all ports 9092:9092 and 2181:2181.

If someone has a working Dockerfile with kafka I would apreaciate it.

2

2 Answers 2

3

YYYYYYY:PORT adress where YYYYYYY is the container id

Without seeing your Dockerfile and the commands you've tried, sounds to me like you are not using localhost outside of the container to access the Docker image, or using the Docker image name, not the container ID.

If a tutorial is showing it working, then I wouldn't think seeing another Dockerfile would help... TBH, just seems like a misconception that the container ID is relevant; or even if you used the container name externally of the container, it's a network error because it is not available to your DNS servers

That all being said, Confluent Quick Start (Docker) gives a good overview of not just Kafka, but also Zookeeper and other Kafka related components

Sign up to request clarification or add additional context in comments.

Comments

2

See https://github.com/confluentinc/cp-docker-images/blob/5.0.0-post/examples/cp-all-in-one/docker-compose.yml for an example of a working Docker Compose.

Also, you need to get your networking configuration right, as Kafka works across hosts and needs to be able to access them all. This post explains it in detail.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.