002_docker构建zookeeper环境
Posted arun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了002_docker构建zookeeper环境相关的知识,希望对你有一定的参考价值。
最近因为要维护公司zk环境,所以自己先得搞一套先玩玩
git地址=>https://github.com/jplock/docker-zookeeper/tree/v3.4.9
一、build docker镜像
Usage: docker build [OPTIONS] PATH | URL | -
Options:
--build-arg list Set build-time variables (default [])
arun:002_zookeeper arunyang$ git clone https://github.com/jplock/docker-zookeeper.git Cloning into \'docker-zookeeper\'... remote: Counting objects: 79, done. remote: Compressing objects: 100% (4/4), done. remote: Total 79 (delta 0), reused 0 (delta 0), pack-reused 75 Unpacking objects: 100% (79/79), done. arun:docker-zookeeper arunyang$ cat README.md docker-zookeeper ================ Builds a docker image for Zookeeper. ```docker build -t <user>/zookeeper:3.4.9 .``` arun:docker-zookeeper arunyang$ docker build -t <user>/zookeeper:3.4.9 . -bash: user: No such file or directory arun:docker-zookeeper arunyang$ docker build -t arun/zookeeper:3.4.9 . Sending build context to Docker daemon 7.68 kB Step 1/11 : FROM openjdk:8-jre-alpine 8-jre-alpine: Pulling from library/openjdk 627beaf3eaaf: Pull complete 1de20f2d8b83: Pull complete 74e619d34827: Pull complete Digest: sha256:e663151c5fdfa89bda49af65b3d477fa1433491290cd35c8f09afa16072f35c4 Status: Downloaded newer image for openjdk:8-jre-alpine ---> c017141bdaa8 Step 2/11 : MAINTAINER Justin Plock <justin@plock.net> ---> Running in 0c6d951e6686 ---> a80c42d6b47c Removing intermediate container 0c6d951e6686 Step 3/11 : ARG MIRROR=http://apache.mirrors.pair.com ---> Running in 79b00a581ec5 ---> 7069c8b9d812 Removing intermediate container 79b00a581ec5 Step 4/11 : ARG VERSION=3.4.9 ---> Running in fe262a6f03e7 ---> 3b2f45ffc932 Removing intermediate container fe262a6f03e7 Step 5/11 : LABEL name "zookeeper" version $VERSION ---> Running in fb4297ebe9bf ---> 533f4472522f Removing intermediate container fb4297ebe9bf Step 6/11 : RUN apk add --no-cache wget bash && mkdir /opt && wget -q -O - $MIRROR/zookeeper/zookeeper-$VERSION/zookeeper-$VERSION.tar.gz | tar -xzf - -C /opt && mv /opt/zookeeper-$VERSION /opt/zookeeper && cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg && mkdir -p /tmp/zookeeper ---> Running in 35d326ef0126 fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz (1/6) Installing ncurses-terminfo-base (6.0-r7) (2/6) Installing ncurses-terminfo (6.0-r7) (3/6) Installing ncurses-libs (6.0-r7) (4/6) Installing readline (6.3.008-r4) (5/6) Installing bash (4.3.46-r5) Executing bash-4.3.46-r5.post-install (6/6) Installing wget (1.18-r2) Executing busybox-1.25.1-r0.trigger OK: 89 MiB in 55 packages ---> 399aab441ac7 Removing intermediate container 35d326ef0126 Step 7/11 : EXPOSE 2181 2888 3888 ---> Running in 08ae7c0f32f5 ---> 79b92b864d83 Removing intermediate container 08ae7c0f32f5 Step 8/11 : WORKDIR /opt/zookeeper ---> d99beccfa087 Removing intermediate container 699022bd0800 Step 9/11 : VOLUME /opt/zookeeper/conf /tmp/zookeeper ---> Running in 2568c9b4be17 ---> 6012fc53e116 Removing intermediate container 2568c9b4be17 Step 10/11 : ENTRYPOINT /opt/zookeeper/bin/zkServer.sh ---> Running in 8b3a643e1d3d ---> 8f21274fe1aa Removing intermediate container 8b3a643e1d3d Step 11/11 : CMD start-foreground ---> Running in df66c9cf7eae ---> d0fd8d6691cb Removing intermediate container df66c9cf7eae Successfully built d0fd8d6691cb
二、启动docker
arun:docker-zookeeper arunyang$ docker run -d --name ele_zookeeper arun/zookeeper:3.4.9 67426e7c0ce5f2753122eafb006fa65f307d21f8a7095b3f5578429bb161fc16
参考:
http://seanlook.com/2014/11/17/dockerfile-introduction/
http://www.cnblogs.com/coolworld/p/5486656.html
以上是关于002_docker构建zookeeper环境的主要内容,如果未能解决你的问题,请参考以下文章
Zookeeper:Docker环境下搭建Zookeeper集群
CentOS 安装 zookeeper(附 docker 安装 zookeeper)
docker云方案——搭建Mesos+Zookeeper+Marathon的Docker管理平台