XrcDPNG66HtreJDo

Kafka Docker Image Usage Guide

Introduction

This document contains usage guide as well as examples for Docker image. Docker Compose files are provided in this directory for the example use cases.

Kafka server can be started using following ways:

Installation Preparation

Note that the Docker version must be >= 20.10.4.

The prior Docker versions may cause permission errors when running the Kafka container, as they do not correctly set directory permissions when creating container paths like /opt/kafka/config.

If you are using the prior version, you may encounter the following error during container startup:

===> User
uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
===> Setting default values of environment variables if not already set.
===> Configuring …
Running in KRaft mode…
/opt/kafka/config/ file not writable

To avoid this, please upgrade Docker to 20.10.4 or later.

Running on default configs

If no user provided configuration (file input or environment variables) is passed to the Docker container, the default KRaft configuration for single combined-mode node will be used. This default configuration is packaged in the Kafka tarball.

Use input file for providing configs

Using Environment Variables

When using the environment variables, you need to set all properties required to start the KRaft node. Therefore, the recommended way to use environment variables is via Docker Compose, which allows users to set all the properties that are needed. It is also possible to use the input file to have a common set of configurations, and then override specific node properties using the environment variables.

Running in SSL mode

Examples

to bring up containers using apache/kafka-native docker image

IMAGE=apache/kafka-native:latest ```

Single Node

Multi Node Cluster