Search code examples
dockerdocker-composedevopsdevops-services

Not able to access elasticsearch from docker container


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


Solution

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