1、部署zookeeper
docker run --restart always --network=host -d -e ALLOW_ANONYMOUS_LOGIN=yes --name zookeeper bitnami/zookeeper:latest
2、部署kakfa
docker run -d --name kafka-server \
--network=host \
-e KAFKA_CFG_NODE_ID=0 \
-e KAFKA_CFG_PROCESS_ROLES=controller,broker \
-e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \
-e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT \
-e [email protected]:9093 \
-e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \
bitnami/kafka:latest