confluentinc / kafka-images

Confluent Docker images for Apache Kafka
Apache License 2.0
28 stars 137 forks source link

kafka-connect not starting on docker Swarm #110

Open jpchev opened 3 years ago

jpchev commented 3 years ago

I'm using the attached docker compose file kafka.zip, and these commands

docker swarm init docker stack deploy --prune --with-registry-auth -c kafka.yml kafka_pd

then the following commands shows 0/1 replicas deployed

[centos@test ~]$ sudo docker service ls
ID             NAME                          MODE         REPLICAS   IMAGE                                  PORTS
72cygx9qy4d9   kafka_pd_kafka           replicated   1/1        confluentinc/cp-kafka:latest           *:9092->9092/tcp
jqu6slwmc8nh   kafka_pd_kafka-connect   replicated   0/1        confluentinc/cp-kafka-connect:latest   *:8083->8083/tcp
4o1yo6y802d8   kafka_pd_zookeeper       replicated   1/1        confluentinc/cp-zookeeper:latest

do you have an idea why the kafka-connect service is not being deployed correctly?

mailoncampos commented 1 year ago

it is necessary to add the 'hostname' property in the service configuration file. Because the swarm network uses DNS in the container name by default.

kafka-connect: image: confluentinc/cp-kafka-connect-base:6.0.0 hostname: kafka-connect depends_on:

fdalonso commented 1 week ago

it is necessary to add the 'hostname' property in the service configuration file. Because the swarm network uses DNS in the container name by default.

kafka-connect: image: confluentinc/cp-kafka-connect-base:6.0.0 hostname: kafka-connect depends_on: - zookeeper - kafka

Thx for this tip! Tested with confluent's 7.7.1 image versions. Using hostname env variable, this annoying problem was gone.