Running Elastic 5.4 on CentOS-Docker(installed by binary file) does not bound

Hi. I am trying to run elasticsearch on centos-docker image.
As far as I know, since running daemon inside the docker container has some problem(like auth..),
I made a Dockerfile like below.

FROM centos
MAINTAINER juneyoung <>

ARG u=elastic
ARG uid=1000
ARG g=elastic
ARG gid=1000
ARG p=elastic

# add USER
RUN groupadd -g ${gid} ${g}
RUN useradd -d /home/${u} -u ${uid} -g ${g} -s /bin/bash ${u} 

# yum settings
RUN yum -y update
RUN yum -y install java-1.8.0-openjdk.x86_64
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-

# install wget
RUN yum install -y wget

# install net-tools : netstat, ifconfig
RUN yum install -y net-tools

# Elasticsearch install

# Binary install
RUN tar -xvf elasticsearch-${ELASTIC_VERSION}.tar.gz
RUN mv elasticsearch-${ELASTIC_VERSION} /home/${u}
RUN rm elasticsearch-${ELASTIC_VERSION}.tar.gz
ENV ELASTIC_HOME=/home/${u}/elasticsearch-${ELASTIC_VERSION}/

# PATH reset

RUN chown -R ${u}:${g} /home/${u}
USER ${u}

EXPOSE 9200 9300

CMD ["elasticsearch"]

I have no trouble with building an image and running the container.
However I can not access elasticsearch via url.

I am using OSX 10, and same setting works in host.
Is there anything I have to do ?


FYI, docker logs looks below

[2017-06-05T01:09:02,721][INFO ][o.e.n.Node               ] [] initializing ...
[2017-06-05T01:09:03,744][INFO ][o.e.e.NodeEnvironment    ] [_j5tAyk] using [1] data paths, mounts [[/ (overlay)]], net usable_space [57.5gb], net total_space [62.7gb], spins? [possibly], types [overlay]
[2017-06-05T01:09:03,745][INFO ][o.e.e.NodeEnvironment    ] [_j5tAyk] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-06-05T01:09:03,750][INFO ][o.e.n.Node               ] node name [_j5tAyk] derived from node ID [_j5tAykbSgacBJ_DWDVrOQ]; set [] to override
[2017-06-05T01:09:03,751][INFO ][o.e.n.Node               ] version[5.4.0], pid[1], build[780f8c4/2017-04-28T17:43:27.229Z], OS[Linux/4.9.27-moby/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_131/25.131-b12]
[2017-06-05T01:09:07,259][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [aggs-matrix-stats]
[2017-06-05T01:09:07,260][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [ingest-common]
[2017-06-05T01:09:07,261][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [lang-expression]
[2017-06-05T01:09:07,261][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [lang-groovy]
[2017-06-05T01:09:07,261][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [lang-mustache]
[2017-06-05T01:09:07,261][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [lang-painless]
[2017-06-05T01:09:07,262][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [percolator]
[2017-06-05T01:09:07,263][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [reindex]
[2017-06-05T01:09:07,264][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [transport-netty3]
[2017-06-05T01:09:07,264][INFO ][o.e.p.PluginsService     ] [_j5tAyk] loaded module [transport-netty4]
[2017-06-05T01:09:07,266][INFO ][o.e.p.PluginsService     ] [_j5tAyk] no plugins loaded
[2017-06-05T01:09:13,563][INFO ][o.e.d.DiscoveryModule    ] [_j5tAyk] using discovery type [zen]
[2017-06-05T01:09:14,889][INFO ][o.e.n.Node               ] initialized
[2017-06-05T01:09:14,902][INFO ][o.e.n.Node               ] [_j5tAyk] starting ...
[2017-06-05T01:09:15,359][INFO ][o.e.t.TransportService   ] [_j5tAyk] publish_address {}, bound_addresses {[::1]:9300}, {}
[2017-06-05T01:09:18,915][INFO ][o.e.c.s.ClusterService   ] [_j5tAyk] new_master {_j5tAyk}{_j5tAykbSgacBJ_DWDVrOQ}{ycVg876bRpqKGYyZGh8L_Q}{}{}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-06-05T01:09:19,011][INFO ][o.e.h.n.Netty4HttpServerTransport] [_j5tAyk] publish_address {}, bound_addresses {[::1]:9200}, {}
[2017-06-05T01:09:19,019][INFO ][o.e.n.Node               ] [_j5tAyk] started
[2017-06-05T01:09:19,065][INFO ][o.e.g.GatewayService     ] [_j5tAyk] recovered [0] indices into cluster_state
[2017-06-05T01:09:49,559][INFO ][o.e.m.j.JvmGcMonitorService] [_j5tAyk] [gc][34] overhead, spent [592ms] collecting in the last [1.5s]

what is the error you are getting when accessing the address?
just regular 404?

you also have an image of elastic in docker hub, that way you just run that image and not building an image alone from docker file.
I use docker-compose to run my container and its going smoothly. you should try that out.

Both ports of 9200 and 9300 in host is LISTEN status.

However, when I called it, it returns any data.
I changed approach.

I run docker with init command and attached into the container.
and inside of the container I commanded elasticsearch, but it still not accessible with browser.

maybe I should not set as localhost?

try to set the to

it makes it accessible from all networks is a non-routable meta-address used to designate an invalid, unknown, or non-applicable target (a ‘no particular address’ place holder).
In the context of a route entry, it usually means the default route.

In the context of servers, means all IPv4 addresses on the local machine. If a host has two IP addresses, and, and a server running on the host listens on, it will be reachable at both of those IPs.

That works for me! Thank you so much!:grinning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.