docker-kafka icon indicating copy to clipboard operation
docker-kafka copied to clipboard

Has anyone been able to start a topic using Docker Compose?

Open andrewterra opened this issue 8 years ago • 6 comments

I attempted to put

kafka:
    image: spotify/kafka
    ports:
      - "9092:9092"
      - "2181:2181"
    hostname: kafka
    expose:
      - "9092"
      - "2181"
    environment:
      TOPICS: test-topic

But this failed to work, is there something that I'm missing? (I tried with quotes around the topic as well)

Also, if anyone has had any luck using Spring to connect to a topic, I would greatly appreciate some help connecting to the topics.

andrewterra avatar Aug 07 '17 14:08 andrewterra

TOPICS env is for spotify/kafkaproxy image.

pugna0 avatar Sep 18 '17 10:09 pugna0

kafka:
  image: spotify/kafka
  ports:
  - "2181:2181"
  - "9092:9092"
  hostname: kafka
  container_name: kafka
  environment:
  - "ADVERTISED_HOST=kafka"
  - "ADVERTISED_PORT=9092"
  - "AUTO_CREATE_TOPICS=true"
  command: >
      bash -c
      "(sleep 15s &&
      /opt/kafka_2.11-0.10.1.0/bin/kafka-topics.sh
      --create
      --zookeeper
      localhost:2181 --replication-factor 1 --partitions 1
      --topic dummy_topic &) && (supervisord -n)"

@terrabl, you can do it like this.

shankarshastri avatar Jun 08 '18 13:06 shankarshastri

Hi there, I have a question. How can I create producer and consumer in "command" section like this topic was created?

Dusanlex avatar Aug 16 '18 10:08 Dusanlex

Hi there, I have a question. How can I create producer and consumer in "command" section like this topic was created? Refer below link: https://gist.github.com/abacaphiliac/f0553548f9c577214d16290c2e751071

pravinsakthivel avatar Jun 25 '19 06:06 pravinsakthivel

AUTO_CREATE_TOPICS

Is this variable really needed? I've managed to get my topic created even without this variable. Could you please explain reason why we need it?

jmayday avatar Jul 05 '19 11:07 jmayday

I did a NuGet package update and that solved my issue

pavanarya avatar Oct 14 '19 06:10 pavanarya