version: '2'
services:
  zookeeper:
    image: zookeeper
    restart: always
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
      - 2181

  kafka:
    image: aelesbao/kafka
    ports:
      - 9092
      - 7203
    environment:
      ZOOKEEPER_IP: zookeeper
      KAFKA_BROKER_ID: -1
      KAFKA_DELETE_TOPIC_ENABLE: "true"
    links:
      - zookeeper
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

Use Docker Compose to start Kafka
Use Docker Compose to start Kafka
