Bitnami Kafka docker container not starting on Ubuntu – Docker

by
Ali Hasan
apache-kafka bitnami-kafka boot2docker docker-compose ubuntu-22.04

Quick Fix: Set ‘BITNAMI_DEBUG=true’ in the environment configuration to see additional logging. This will help you identify the root cause of the issue.

The Problem:

A docker-compose configuration is provided to run bitnami/zookeeper and bitnami/kafka containers. However, only the zookeeper container starts successfully. Inspecting the logs of the kafka container reveals warnings related to missing listeners for the CONTROLLER and the absence of KAFKA_KRAFT_CLUSTER_ID. The user has verified that port 9092 is not in use by any other process, and the techBankNet network exists. The issue needs to be identified and resolved to start the bitnami/kafka container successfully.

The Solutions:

Solution 1: Examine Kafka Logs with BITNAMI_DEBUG

To diagnose the issue, set BITNAMI_DEBUG=true in the environment configuration to enable additional logging:

kafka:
  image: bitnami/kafka
  ports:
    - "9092:9092"
  volumes:
    - "kafka_data:/bitnami"
  environment:
    - BITNAMI_DEBUG=true
    - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
    - ALLOW_PLAINTEXT_LISTENER=yes
    - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
    - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
  depends_on:
    - zookeeper

This will provide more detailed error messages, which can help identify the root cause of the issue.

Q&A

How to resolve ‘controller.listener.names must contain at least one value appearing in the ‘listeners’ configuration when running the KRaft controller role’ error?

Set BITNAMI_DEBUG=true in the environment configuration to see additional logging.

Video Explanation:

The following video, titled "Kafka Running in Less Than 5 Minutes - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Get Kafka up and running fast on your machine with docker/docker-compose. Bitnami Kafka Docker compose file: ...