Home > Software design >  docker kafka broker is not accessible from outside or other docker container
docker kafka broker is not accessible from outside or other docker container

Time:09-06

I'm running kafka broker in docker containers, zookeeper in a separate container.

I tried to reach the zookeeper from my local, It works fine.

I tried to reach the broker from my local, it throws the below error and eventually fails.

[Timestamp] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 65 : {tmpc=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[Timestamp] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 66 : {tmpc=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)

I used port (-p and --link) and I also tried with a separate network. I'm able to access zookeeper in both scenarios but I can't access the broker.

I have a base image which just has kafka unzipped and java installed in it. It runs in ubuntu

Docker image for zookeeper:

FROM IMAGE
COPY ./zookeeper_setup.sh  zookeeper_setup.sh
ENTRYPOINT ["sh","zookeeper_setup.sh"]

Zookeeper setup: # Just changing the log dir so I can mount it to a location and using the same 2181 port by default

sed -i "s           
  • Related