方式一:kafka docker安装
1、docker pull bitnami/kafka:latest
2、docker network create app-tier --driver bridge
3、
docker run -d --name zookeeper-server \
--network app-tier \
-e ALLOW_ANONYMOUS_LOGIN=yes \
-p 2181:2181 \
bitnami/zookeeper:latest
4、
docker run -d --name kafka-server \
--network app-tier \
-e ALLOW_PLAINTEXT_LISTENER=yes \
-e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 \
-p 9092:9092 \
bitnami/kafka:latest
方式二:kafka+zk+kafka-Manager
参考:Docker安装Kafka和Kafka-Manager - 简书
1、docker pull wurstmeister/zookeeper
2、docker pull wurstmeister/kafka
3、docker pull sheepkiller/kafka-manager
4、启动镜像
docker run -d --name zookeeper -p 2181:2181 -e TZ="Asia/Shanghai" --restart always wurstmeister/zookeeper
docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=10.60.61.20:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://10.60.61.20:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 -e TZ="Asia/Shanghai" wurstmeister/kafka
docker run -d --name kfk-manager --restart always -p 9000:9000 -e ZK_HOSTS=10.60.61.20:2181 sheepkiller/kafka-manager