1. 程式人生 > >7、Docker 安裝 Zookeeper

7、Docker 安裝 Zookeeper

Docker 安裝 Zookeeper

拉取 ZooKeeper 映象 https://hub.docker.com/_/zookeeper/

查詢 Docker Hub 上的 Zookeeper 映象:

[[email protected] ~]# docker search zookeeper
NAME                                DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
zookeeper                           Apache ZooKeeper is an open-source server wh…   532                 [
OK] jplock/zookeeper Builds a docker image for Zookeeper version … 162 [OK] mesoscloud/zookeeper ZooKeeper 73 [OK] wurstmeister/zookeeper 64 [
OK] confluentinc/cp-zookeeper Official Confluent Docker Image for Zookeeper 39 mbabineau/zookeeper-exhibitor 23 [OK] digitalwonderland/zookeeper Latest Zookeeper - clusterable 18 [
OK] confluent/zookeeper 13 [OK] tobilg/zookeeper-webui Docker image for using `zk-web` as ZooKeeper… 10 [OK] bitnami/zookeeper ZooKeeper is a centralized service for distr… 10 [OK] hyperledger/fabric-zookeeper Fabric Zookeeper docker image for Hyperledge… 10 debezium/zookeeper Zookeeper image required when running the De… 8 [OK] springxd/zookeeper A Docker image that can run a ZooKeeper serv… 6 [OK] 31z4/zookeeper Dockerized Apache Zookeeper. 5 [OK] thefactory/zookeeper-exhibitor Exhibitor-managed ZooKeeper with S3 backups … 5 [OK] paulbrown/zookeeper Zookeeper on Kubernetes (PetSet) 1 [OK] ciscocloud/zookeeper 1 [OK] openshift/zookeeper-346-fedora20 ZooKeeper 3.4.6 with replication support 1 midonet/zookeeper Dockerfile for a Zookeeper server. 0 [OK] duffqiu/zookeeper-cli 0 [OK] jamiecressey89/marathon-zookeeper Zookeeper image that uses Marathon's API for… 0 [OK] strimzi/zookeeper 0 josdotso/zookeeper-exporter ref: https://github.com/carlpett/zookeeper_e… 0 [OK] phenompeople/zookeeper Apache ZooKeeper is an open-source server wh… 0 [OK] avvo/zookeeper Apache Zookeeper 0 [OK] [[email protected] ~]#

這裡我們拉取官方的映象,標籤為 3.4.13

docker pull zookeeper:3.4.13

等待下載完成後,我們就可以在本地映象列表裡查到 REPOSITORYzookeeper ,標籤為 3.4.13 的映象。

[[email protected] ~]# docker images | grep zookeeper
zookeeper           3.4.13              f336949ce7a1        5 weeks ago         148MB
[[email protected] ~]# 

搭建 zookeeper 單機版

執行容器

預設使用 2181

docker run --name 容器名稱 -p 2181:2181 --restart always -d zookeeper:3.4.13

檢視容器啟動情況:

[[email protected] ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                        NAMES
8177759ce014        zookeeper:3.4.13    "/docker-entrypoint.…"   6 days ago          Up About an hour    2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp   zookeeper-1
[[email protected] ~]# 

檢視日誌:

docker logs -f my_zookeeper