“ZooKeeper安装”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
第2行: 第2行:
  
  
docker-compose.yml<syntaxhighlight lang="yaml">
+
docker-compose.yml(默认配置文件名)<syntaxhighlight lang="yaml">
version:"3.1"
+
version: "3.1"
service:
+
services:
 
   zk:
 
   zk:
     image:daocloud.io/daocloud/zookeeper:latest
+
     image: daocloud.io/daocloud/zookeeper:latest
     restart:always
+
     restart: always
     container_name:zk
+
     container_name: zk
 
     ports:
 
     ports:
 
       - 2181:2181
 
       - 2181:2181
 +
</syntaxhighlight>根据 docker-compose.yml 配置文件创建并启动容器<syntaxhighlight lang="shell-session">
 +
[root@bogon docker_zk]# docker-compose up -d
 +
Creating network "dockerzk_default" with the default driver
 +
Creating zk ... done
 +
[root@bogon docker_zk]#
 
</syntaxhighlight>
 
</syntaxhighlight>

2022年8月15日 (一) 22:40的版本

用 docker-compose 安装 ZooKeeper


docker-compose.yml(默认配置文件名)

version: "3.1"
services:
  zk:
    image: daocloud.io/daocloud/zookeeper:latest
    restart: always
    container_name: zk
    ports:
       - 2181:2181

根据 docker-compose.yml 配置文件创建并启动容器

[root@bogon docker_zk]# docker-compose up -d
Creating network "dockerzk_default" with the default driver
Creating zk ... done
[root@bogon docker_zk]#