嘗試了半天才成功:
docker-compose.yml
# Copyright Broadcom, Inc. All Rights Reserved. # SPDX-License-Identifier: APACHE-2.0 version: "2" services: kafka-ui: image: provectuslabs/kafka-ui:latest ports: - "8080:8080" environment: - KAFKA_CLUSTERS_0_NAME=local - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:29092 - DYNAMIC_CONFIG_ENABLED=true depends_on: - kafka logging: driver: "json-file" options: max-file: "5" # number of files or file count max-size: "20m" # file size kafka: image: docker.io/bitnami/kafka:3.8 ports: - "9092:9092" - "29092:29092" - "9091:9091" volumes: - /home/cuyz/kafka/kafka-data:/bitnami/kafka environment: # KRaft settings - KAFKA_CFG_NODE_ID=0 - KAFKA_CFG_PROCESS_ROLES=controller,broker - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - KAFKA_KRAFT_CLUSTER_ID=z69JshU3NV7uhxln9uNDZg== # Listeners - KAFKA_CFG_LISTENERS=PLAINTEXT://kafka:29092,CONTROLLER://kafka:9093 - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - KAFKA_CFG_ALLOW_PLAINTEXT_LISTENER=yes volumes: kafka_data: driver: local