xiaoming728

xiaoming728

Docker环境安装zookeeper

2023-12-11
Docker环境安装zookeeper

1、搜索镜像

docker search zookeeper

[admin@localhost ~]$ sudo docker search zookeeper
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
zookeeper                          Apache ZooKeeper is an open-source server wh…   817                 [OK]
jplock/zookeeper                   Builds a docker image for Zookeeper version …   164                                     [OK]
wurstmeister/zookeeper                                                             110                                     [OK]
mesoscloud/zookeeper               ZooKeeper                                       73                                      [OK]
bitnami/zookeeper                  ZooKeeper is a centralized service for distr…   27                                      [OK]

2、镜像下载

下载第一个官方提的镜像

docker pull zookeeper

[admin@localhost ~]# sudo docker pull zookeeper
Using default tag: latest
Trying to pull repository docker.io/library/zookeeper ...
latest: Pulling from docker.io/library/zookeeper
1ab2bdfe9778: Already exists
7aaf9a088d61: Pull complete
80a55c9c9fe8: Pull complete
a0086b0e6eec: Pull complete
4165e7457cad: Pull complete
bcba13bcf3a1: Pull complete
41c03a109e47: Pull complete
4d5281c6b0d4: Pull complete
Digest: sha256:175d6bb1471e1e37a48bfa41a9da047c80fade60fd585eae3a0e08a4ce1d39ed
Status: Downloaded newer image for docker.io/zookeeper:latest

3、安装镜像

执行以下命令即可安装成功

docker run -d -p 2181:2181 \
   -v /home/docker/zookeeper/data:/data \
   -v /home/docker/zookeeper/logs:/logs \
   -v /home/docker/zookeeper/datalog:/datalog \
   --name zookeeper \
   --restart=always \
   zookeeper:latest