apache kafka – No security protocol defined for listener

I have this error after starting Kafka with docker-compose start: No security protocol defined for listener

This is my docker-composer.yaml

version: '3'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
 
    ports:
      - 2181:2181
    volumes:
      - ./data/zookeeper_data:/var/lib/zookeeper/data
      - ./data/zookeeper_log:/var/lib/zookeeper/log      

  kafka:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
      - 9094:9094
    volumes:
      - ./data/kafka1/data:/var/lib/kafka/data
      - ./data/kafka1/etc:/etc/kafka
    environment:
      ALLOW_PLAINTEXT_LISTENER: yes
      KAFKA_ENABLE_KRAFT: no
      KAFKA_BROKER_ID: 1
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
      KAFKA_LISTENERS: INTERNAL://:9092,OUTSIDE://:9094
      KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,OUTSIDE://localhost:9094
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT

if I delete all the folders inside data that contain all the volumes kafka starts fine.

What would it be the problem ?

Read more here: Source link