0
votes

elastic search is successfully running on docker container. but i'm not able access in browser. i mapped ports correctly. but the problem is in docker container. in container elasticsearch is mapped with localhost

127.0.0.1:9200
Dokcerfile
FROM ubuntu:16.04 MAINTAINER Rajesh Gurram

RUN apt-get update && \ apt-get install -y net-tools curl wget gnupg RUN apt-get install -y software-properties-common

RUN add-apt-repository ppa:webupd8team/java && \ apt-get update && \ echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ apt-get install -y oracle-java8-installer && apt-get clean

ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

RUN apt-get install apt-transport-https RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - && \ echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-6.x.list && \ apt update && apt install -y elasticsearch

RUN sed -i 's/#network.host: 192.168.0.1/network.host: 0.0.0.0/g' /etc/elasticsearch/elasticsearch.yml

EXPOSE 9200 9300

2
Could you share your docker file? - Maor Refaeli
localhost inside your container will point to localhost of your container. Not to the localhost on your host where your ES is running. Deploy your container in the host network or use something like -add-host parameters. If your ES is also running in docker you can use a named bridge network to connect using container name. - lvthillo

2 Answers

1
votes

Run Below command on Host machine it will resolve the issue
$ sysctl -w vm.max_map_count=262144

0
votes

If you want to use docker to get an instance of Elasticsearch, you can read the following Guide:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

You can also use docker images directly from elastic, if ubuntu is not a necessary base image:
https://www.docker.elastic.co/

If you want to upgrade to an ELK Stack later on, I recommend a docker volume for persistency purposes.