version: "3" # Docker Compose format version services: kafka: image: apache/kafka:latest container_name: kafka-crash-test ports: - "9092:9092" # host:container environment: KAFKA_NODE_ID: 1 # node identifier in cluster KAFKA_PROCESS_ROLES: broker,controller # Combined broker + controller (KRaft mode, no Zookeeper) KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093 # Controller nodes for quorum (node_id@host:port) # Listener configuration KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 # Ports Kafka listens on internally KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 # Address advertised to clients KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER # Listener for controller communication KAFKA_LOG_DIRS: /var/lib/kafka/data # Directory for message data storage volumes: - ./kafka-data:/var/lib/kafka/data # Persist data across container restarts