Move to any of the folders containing docker-compose.yml file.
Folders bring up different stacks. They start from zookeeper, kafka and schema registry and are enhanced to zookeeper, kafka, schema registry, rest proxy, kafka connect, topic-ui, connect-ui, scheam-ui.
-
Start kafka platform:
docker-compose up -d
-
Optional create and check topic:
docker-compose exec kafka kafka-topics --create --topic foo --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeper:2181
docker-compose exec kafka kafka-topics --describe --topic foo --zookeeper zookeper:2181
docker-compose exec kafka bash -c "seq 42 | kafka-console-producer --request-required-acks 1 --broker-list kafka:9092 --topic foo && echo 'Produced 42 messages.'"
docker-compose exec kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic foo --new-consumer --from-beginning --max-messages 42
-
Stop platform:
docker-compose rm -s -f -v
Run docker for windows with linux containers
https://docs.confluent.io/current/installation/docker/docs/installation/single-node-client.html
-
Create network:
docker network create confluent
-
Start zookeeper:
docker run -d --net=confluent --name=zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:5.0.0
-
Check zookeeper:
docker logs zookeeper
-
Start kafka:
docker run -d --net=confluent --name=kafka -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:5.0.0
-
Check kafka:
docker logs kafka
-
Start schema registry:
docker run -d --net=confluent --name=schema-registry -e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=zookeeper:2181 -e SCHEMA_REGISTRY_HOST_NAME=schema-registry -e SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081 confluentinc/cp-schema-registry:5.0.0
-
Check schema registry:
docker logs schema-registry
-
Optional create and check topic:
docker run --net=confluent --rm confluentinc/cp-kafka:5.0.0 kafka-topics --create --topic foo --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:2181
docker run --net=confluent --rm confluentinc/cp-kafka:5.0.0 kafka-topics --describe --topic foo --zookeeper zookeeper:2181