创建zk
shell
docker run -d --name zookeeper-server \
-e ALLOW_ANONYMOUS_LOGIN=yes \
bitnami/zookeeper:latest
创建kafka
shell
docker run -d --name kafka-server \
-p 9092:9092 \
-e ALLOW_PLAINTEXT_LISTENER=yes \
-e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 \
-e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://192.168.0.101:9092 \
bitnami/kafka:latest
按实际情况修改KAFKA_CFG_ZOOKEEPER_CONNECT
,KAFKA_CFG_ADVERTISED_LISTENERS