Sign inSign up

ueisele/apache-kafka-server-standalone

By ueisele

•Updated 10 months ago

Standalone Docker Image for Apache Kafka Broker and Controller

Image
0

10K+

ueisele/apache-kafka-server-standalone repository overview

⁠Standalone Container Image for Apache Kafka Broker and Controller

Container image for running the Open Source version of Apache Kafka⁠. It offers support for running a single Apache Kafka instance in Kafka KRaft mode⁠.

The Kafka distribution included in the Container image is built directly from source⁠.

The standalone Container image is based on ueisele/apache-kafka-server⁠.

The Container images are available on Docker Hub repository ueisele/apache-kafka-server-standalone⁠, and the source files for the images are available on GitLab repository ueisele/kafka-images⁠.

⁠Most Recent Tags

Most recent tags for RELEASE builds:

  • 3.5.0, 3.5.0-zulu20, 3.5.0-zulu20.0.1, 3.5.0-zulu20-alma9.2, 3.5.0-zulu20.0.1-alma9.2-20230512
  • 3.4.1, 3.4.1-zulu17, 3.4.1-zulu17.0.7, 3.4.1-zulu17-alma9.2, 3.4.1-zulu17.0.7-alma9.2-20230512

Most recent tags for SNAPSHOT builds:

  • 3.6.0-SNAPSHOT, 3.6.0-SNAPSHOT-zulu20, 3.6.0-SNAPSHOT-zulu20.0.1, 3.6.0-SNAPSHOT-zulu20-alma9.2, 3.6.0-SNAPSHOT-zulu20.0.1-alma9.2-20230512

Additionally, a tag with the associated Git-Sha of the built Apache Kafka distribution is always published as well, e.g. ueisele/apache-kafka-server-standalone:3.6.0-SNAPSHOT-g09e8adb.

⁠Image

The Container images are based on ueisele/zulu-openjdk-micro⁠ with JRE installed (e.g. 20-jre).

The OpenJDK image in turn is based on AlmaLinux 9 Micro⁠.

As OpenJDK Azul Zulu⁠ is used. Azul Zulu builds of OpenJDK are fully tested and TCK compliant builds of OpenJDK.

⁠Quick Start

To start a single Kafka server instance in KRaft mode just run:

podman run --rm -p 19092:19092 ueisele/apache-kafka-server-standalone:3.5.0

If you use Podman, the container network is not reachable from localhost. You can use port 19092, which exposes localhost:19092 as advertised listener.

If you use Docker, you can directly use port 9092 and bind it to any host port. The reason is, that <container-ip>:9092 is exposed, which is reachable if Docker is used.

docker run --rm -p 9092:9092 ueisele/apache-kafka-server-standalone:3.5.0

To start a single Kafka instance in KRaft mode with Ipv6 just run:

podman network create --ipv6 --subnet fd01::/80 kafka-standalone
podman run --rm -p 19092:19092 --net kafka-standalone -e STANDALONE_BROKER_IP_VERSION=ipv6 ueisele/apache-kafka-server-standalone:3.5.0

⁠Configuration

The ueisele/apache-kafka-server-standalone⁠ image just sets environment variables which are required for a standalone execution (see Containerfile⁠).

The configuration is identical to the ueisele/apache-kafka-server⁠ image and therefore also fully compatible with the Confluent Docker images⁠.

For the Apache Kafka (ueisele/apache-kafka-server-standalone⁠) image, convert the Apache Kafka broker configuration properties⁠ as below and use them as environment variables:

  • Prefix with KAFKA_.
  • Convert to upper-case.
  • Replace a period (.) with a single underscore (_).
  • Replace a dash (-) with double underscores (__).
  • Replace an underscore () with triple underscores (__).
⁠Listeners

By default the standalone Kafka opens a listener on port 9092 on all interfaces and advertises the first found Ip address.

However, you can overwrite the advertised listener and the listener of the broker with STANDALONE_BROKER_LISTENERS and STANDALONE_BROKER_ADVERTISED_LISTENERS. For example STANDALONE_BROKER_LISTENERS=PLAINTEXT://127.0.0.1:9092 and STANDALONE_BROKER_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092.

The security protocol map for the broker can be set with STANDALONE_BROKER_LISTENER_SECURITY_PROTOCOL_MAP.

If you only want to change the port of the broker, you can set STANDALONE_BROKER_PORT.

In addition to the STANDALONE_BROKER_ variables, you can also directly specify KAFKA_ variables. STANDALONE_BROKER_ variables are just a convenient way to configure the standalone Kafka instance without the need to also set the controller configuration.

⁠Logging

The logging configuration can be adjusted with the following environment variables:

  • KAFKA_LOG4J_PATTERN sets the logging pattern (default: [%d] (%t) %p %m (%c)%n)
  • KAFKA_LOG4J_ROOT_LOGLEVEL sets the root log level (default: INFO)
  • KAFKA_LOG4J_LOGGERS is a comma separated list of logger and log level key-value pairs (default: kafka=INFO,kafka.network.RequestChannel$=WARN,kafka.producer.async.DefaultEventHandler=DEBUG,kafka.request.logger=WARN,kafka.controller=TRACE,kafka.log.LogCleaner=INFO,state.change.logger=TRACE,kafka.authorizer.logger=WARN)
⁠JMX

Remote JMX can be enabled with the following environment variables:

KAFKA_JMX_PORT=6001
KAFKA_JMX_HOSTNAME=localhost
⁠Debugging

In order to debug Apache Kafka, set the following environment variable:

KAFKA_DEBUG=y

In addition you can configure the behavior with the following environment variables:

JAVA_DEBUG_PORT=5005
DEBUG_SUSPEND_FLAG=y

⁠Build

In order to create your own Container image for Apache Kafka clone the ueisele/kafka-image⁠ Git repository and run the build command:

git clone https://gitlab.com/ueisele/kafka-images.git
cd kafka-images
server-standalone/build.sh --build --tag 3.5.0 --openjdk-release 20

To create an image with a specific OpenJDK version use the following command:

server-standalone/build.sh --build --tag 3.5.0 --openjdk-release 20 --openjdk-version 20.0.1

To build the most recent SNAPSHOT of Apache Kafka 3.5.0 with Java 17, run:

server-standalone/build.sh --build --branch trunk --openjdk-release 17
⁠Build Options

The server-standalone/build.sh script provides the following options:

Usage: server-standalone/build.sh [--build] [--push] [--registry docker.io] [--user ueisele] [--archs amd64,arm64] [--github-repo apache/kafka] [--commit-sha 09e8adb] [--tag 3.5.0] [--branch trunk] [--pull-request 9999] [--openjdk-release 20] [--openjdk-version 20.0.1]

⁠License

This Container image is licensed under the Apache 2 license⁠.

Tag summary

Content type

Image

Digest

sha256:639f0a177…

Size

142.4 MB

Last updated

10 months ago

docker pull ueisele/apache-kafka-server-standalone:4.2.0-SNAPSHOT-g358dc27-zulu21.0.9-alma10.1-20251124-202511291256