---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper
ports:
- "2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
broker1:
image: confluentinc/cp-kafka
depends_on:
- zookeeper
ports:
- '9092'
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker1:9092'
and here are the properties that the kafka server was started with (this is what the Kafka image generates when it runs the launch script. I did not modify it)
However when I go to produce and consume messages using the kafka/zookeeper that I have running, I get the following error:
ERROR Error when sending message to topic foo with key: null, value: 16 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback) org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for foo-0 due to 2303 ms has passed since batch creation plus linger time
and nothing happens to my running consumer.
Now, if I go into the container and do the same thing (except with the local port number) everything works beautifully.
what am I missing/doing wrong that I am not able to produce and consume messages from outside of the container?
Thanks
Nima