Elasticsearch is a distributed, free and open search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured.
Elasticsearch is the central component of the Elastic Stack, a set of free and open tools for data ingestion, enrichment, storage, analysis, and visualization.
It is considerably easier and faster to run elasticsearch in a container than to install it on a host server.
1)Create a docker file and add the below contents.
# vim Dockerfile
FROM centos:7 MAINTAINER vishakkv954@gmail.com RUN useradd -ms /bin/bash elasticsearch RUN yum -y install java-1.8.0-openjdk-devel RUN yum -y install wget RUN wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpm RUN rpm -ivh elasticsearch-5.5.0.rpm RUN mkdir /usr/share/elasticsearch/config RUN cp -R /usr/share/elasticsearch/* /home/elasticsearch/ COPY elasticsearch.yml /home/elasticsearch/config/ COPY log4j2.properties /home/elasticsearch/config/ RUN chown -R elasticsearch:elasticsearch /home/elasticsearch/* WORKDIR /home/elasticsearch USER elasticsearch EXPOSE 9200 EXPOSE 9300 CMD ["/home/elasticsearch/bin/elasticsearch"]
elasticsearch.yml and log4j2.properties are the updated files with the configurations needed for our elasticsearch.Place both files in the same directory where dockerfile exists.
2) Build docker image
NB: be in the directory where dockerfile exists
docker build -t elasticsearh .
"elasticsearch is the image name"
3) Create docker container
# docker images
#to get the docker image id
# docker run -d -P 9200:9200 -P 9300:9300 --name elastic <image id>
4) check container status
# docker ps
Play with docker🥂
Top comments (0)