Installation

docker network create kafka-net

docker run -d \\
  --name zookeeper \\
  --network kafka-net \\
  -p 2181:2181 \\
  -e ZOOKEEPER_CLIENT_PORT=2181 \\
  confluentinc/cp-zookeeper:latest

docker run -d \\
  --name kafka \\
  --network kafka-net \\
  -p 9092:9092 \\
  -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \\
  -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 \\
  -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \\
  confluentinc/cp-kafka:latest

# Test Kafka
## Create a topic
docker exec -it kafka kafka-topics --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1

## Produce a message
docker exec -it kafka kafka-console-producer --topic test-topic --bootstrap-server localhost:9092

## Consume messages
docker exec -it kafka kafka-console-consumer --topic test-topic --bootstrap-server localhost:9092 --from-beginning

# Install conduktor for UI manages: <https://docs.conduktor.io/platform/installation/get-started/docker/>