最近有个需求,使用docker搭建一个elastixsearch服务。那就来看看吧。docker一个优点就是可以快速搭建服务。也是初学docker ~~ 错误之处 请指教
首先这里有个Dockerfile
FROM ubuntu:14.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common && add-apt-repository -y ppa:webupd8team/java && apt-get update && (echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections) && apt-get install --no-install-recommends -y oracle-java8-installer && rm -rf /var/cache/oracle-jdk8-installer && echo "networkaddress.cache.ttl=60" >> /usr/lib/jvm/java-8-oracle/jre/lib/security/java.security && apt-get clean && rm -rf /var/lib/apt/lists/* ENV JAVA_HOME /usr/lib/jvm/java-8-oracle RUN groupadd -g 1000 elasticsearch && useradd elasticsearch -u 1000 -g 1000 RUN apt-key adv --keyserver pgp.mit.edu --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 && add-apt-repository -y "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" --keyserver https://pgp.mit.edu/ && apt-get update && apt-get install -y --no-install-recommends elasticsearch WORKDIR /usr/share/elasticsearch RUN set -ex && for path in data logs config config/scripts plugins/ik; do mkdir -p "$path"; chown -R elasticsearch:elasticsearch "$path"; done COPY logging.yml /usr/share/elasticsearch/config/ COPY ik /usr/share/elasticsearch/plugins/ik/ COPY elasticsearch.yml /usr/share/elasticsearch/config/ USER elasticsearch ENV PATH=$PATH:/usr/share/elasticsearch/bin CMD ["elasticsearch"] EXPOSE 9200 9300
创建镜像
docker build -t elasticsearch . #在dockerfile目录下执行
其次创建一个volume
docker volume create --name dataes
docker run -d -p 9200:9200 --name=elasticsearch -v dataes:/usr/share/elasticsearch/data elasticsearch
over
本文出自 “好记性不如烂笔头” 博客,请务必保留此出处http://cobweb.blog.51cto.com/390607/1864335
原文地址:http://cobweb.blog.51cto.com/390607/1864335