安装
curl -L "(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
创建docker-compose.yml
-
version: '2.0'
-
services:
-
zookeeper0:
-
build:
-
context: .
-
dockerfile: zookeeper.Dockerfile
-
image: akin520/zookeeper:3.4.6
-
container_name: zookeeper0
-
hostname: zookeeper0
-
ports:
-
- "2181:2181"
-
- "2888:2888"
-
- "3888:3888"
-
expose:
-
- 2181
-
- 2888
-
- 3888
-
environment:
-
ZOOKEEPER_PORT: 2181
-
ZOOKEEPER_ID: 0
-
ZOOKEEPER_SERVERS: server.0=zookeeper0:2888:3888 server.1=zookeeper1:28881:38881 server.2=zookeeper2:28882:38882
生成镜像
docker-compose build
运行
docker-compose up
docker-compose up -d后台运行
删除
docker-compose stop && docker-compose rm -f
阅读(1867) | 评论(0) | 转发(0) |