安装Zookeeper
docker run --name zookeeper -d -p 2181:2181 -v /etc/localtime:/etc/localtime library/zookeeper
安装Kafka
docker run -d --name kafka -p 9092:9092 --link zookeeper --env KAFKA_ZOOKEEPER_CONNECT=IP:2181/kafka --env KAFKA_ADVERTISED_HOST_NAME=IP --env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://IP:9092 --env KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 --env KAFKA_ADVERTISED_PORT=9092 --env KAFKA_HEAP_OPTS=-Xmx2G wurstmeister/kafka
安装kafka-manager
docker run -itd --name=kafka-manager -p 9000:9000 -e ZK_HOSTS="IP:2181" sheepkiller/kafka-manager
验证kafka
dokcer exec -it kafka /bin/bash
bin/kafka-topics.sh --create --bootstrap-server IP:9092 --topic mytest --partitions 1 --replication-factor 1
kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic mytest
标签:KAFKA,--,IP,9092,kafka,env,Docker,Kafka,安装 From: https://www.cnblogs.com/snail-gao/p/16660206.html