I’m trying to use Debezium with Kafka connect, I followed this tutorial, and everything connected just fine. However, the problem is that I cannot access Kafka from outside of docker containers anymore.
I use these commands to start containers:
docker run -it --rm --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper:2.0.0.Beta1
docker run -it --rm --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka:2.0.0.Beta1
docker run -it --rm --name connect -p 8083:8083 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my_connect_configs -e OFFSET_STORAGE_TOPIC=my_connect_offsets --link kafka:kafka debezium/connect:2.0.0.Beta1
I tried to set KAFKA_ADVERTISED_LISTENERS
to PLAINTEXT://127.0.0.1:9092
which allowed me to connect to Kafka from the outside of the container but I could not connect from connect
container to kafka
container anymore. How can I achieve both?
2
Answers
I think it’s not a Kafka issue, but a docker network one. It’s probably accessible via docker network or you need to expose it. https://docs.docker.com/network/network-tutorial-standalone/
with this you can access the kafka container from your host on the port 9092