欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Docker安装Zookeeper单机版本

程序员文章站 2022-07-13 10:09:38
...
# 拉取 3.4.10版本的
[[email protected] ~]# docker pull zookeeper:3.4.10
3.4.10: Pulling from library/zookeeper
b56ae66c2937: Pull complete 
81cebc5bcaf8: Pull complete 
3b27fd892ecb: Pull complete 
6696ccdcd9ed: Pull complete 
a12f6b1c4023: Pull complete 
91e6981f84cd: Pull complete 
cb79785eedc3: Pull complete 
Digest: sha256:0e0dba8ed2eb0769bf1592809940702194a8db9c4d184b7c6b7040c923211648
Status: Downloaded newer image for zookeeper:3.4.10
docker.io/library/zookeeper:3.4.10

查看docker 镜像

[[email protected] ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
springbootdemo4docker   latest              e2c24e317572        4 weeks ago         676MB
zookeeper               3.4.10              d9fe1374256f        2 years ago         144MB
[[email protected] ~]# 

单机方式运行docker镜像

d9fe1374256f 是 images的IMAGE ID ,就是你要运行那个image ,这个就写那个image的id

[[email protected] ~]# docker run -d -p 2181:2181 --name some-zookeeper --restart always d9fe1374256f        
90e898963a820ba363e3fb4f6664fbce298661a1d8754d496b6698bb29496bd6

查看是否启动

[[email protected] ~]# docker ps -a         
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                                        NAMES
90e898963a82        d9fe1374256f         "/docker-entrypoint.…"   2 minutes ago       Up 3 seconds        2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp   some-zookeeper

看样子已经启动了.

外部连接Zookeeper

发现可以正常连接, 说明安装成功
Docker安装Zookeeper单机版本