# 拉取镜像
docker pull wurstmeister/zookeeper
docker pull wurstmeister/kafka
# 创建容器
docker run -d --name zookeeper -p 2181 -t wurstmeister/zookeeper
docker run -d --name kafka --publish 9092:9092 --link zookeeper --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 --env KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 --env KAFKA_ADVERTISED_PORT=9092 --volume /etc/localtime:/etc/localtime wurstmeister/kafka:latest
# 找到启动文件
find / -name kafka-topics.sh
find / -name zkServer.sh
# 启动zookeeper
# 1、进入容器
docker exec -it zookeeper /bin/bash
# 2、执行.sh文件
root@784a67353215:/opt/zookeeper-3.4.13/bin# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
# 3、查看启动是否成功
root@784a67353215:/opt/zookeeper-3.4.13/bin# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: standalone
docker安装zookeeper
于 2024-09-30 15:41:02 首次发布