I am running wurstmeister/kafka in a ubuntu 14.04 LTS machine. Kafka container is running fine. However I am not able to connect my microservice to this container.
Kafka docker-compose.yml:
version: '2'
services:
zookeeper:
image: user1/zookeeper:3.4.9
ports:
- "2181:2181"
kafka:
image: my-kafka
ports:
- "9092:9092"
hostname: kafka-01
environment:
KAFKA_ADVERTISED_PORT: 9092
KAFKA_ADVERTISED_HOST_NAME: "kafka-01"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CREATE_TOPICS: "topic1:1:1,topic2:1:1"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
docker-compose for microservice(myapp):
version: '2'
services:
myapp:
network_mode: 'bridge'
extends:
file: myapp.base.yml
service: myapp
links:
- kafka
zookeeper:
network_mode: 'bridge'
extends:
file: zookeeper.yml
service: zookeeper
kafka:
network_mode: 'bridge'
extends:
file: kafka.yml
service: kafka
links:
- zookeeper
I have linked kafka in an env:
kafkaHost=kafka-01:9092
Please let me know what am I doing wrong or if more info is required. Thanks in advance.