Docker Community Forums

Share and learn in the Docker community.

Custom Elasticsearch image does not run properly

I want to build a custom Elasticsearch image which using my own elasticsearch.yml file (which works fine if I install Elasticsearch and use it in windows). I follow instruction to create Dockerfile here.

This is the Dockerfile:

FROM elasticsearch:5.6.11
COPY --chown=elasticsearch:elasticsearch ./elasticsearch.yml /usr/share/elasticsearch/config/

I build the image and run it without any error. This is the log of the container after running:

[2020-04-13T16:18:52,677][INFO ][o.e.n.Node               ] [] initializing ...
[2020-04-13T16:18:52,895][INFO ][o.e.e.NodeEnvironment    ] [DCdtI8f] using [1] data paths, mounts 
[[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [44.6gb], net total_space [58.4gb], spins? [possibly], types [ext4]
[2020-04-13T16:18:52,895][INFO ][o.e.e.NodeEnvironment    ] [DCdtI8f] heap size [1.9gb], compressed ordinary object pointers [true]
[2020-04-13T16:18:52,897][INFO ][o.e.n.Node               ] node name [DCdtI8f] derived from node ID 
[DCdtI8fZRJu1RpF5q-LW3A]; set [node.name] to override
[2020-04-13T16:18:52,897][INFO ][o.e.n.Node               ] version[5.6.11], pid[1], build[bc3eef4/2018-08-16T15:25:17.293Z], OS[Linux/4.19.76-linuxkit/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_181/25.181-b13]
[2020-04-13T16:18:52,898][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/elasticsearch]
 [2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [aggs-matrix-stats]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [ingest-common]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [lang-expression]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [lang-groovy]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [lang-mustache]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [lang-painless]
 [2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [parent-join]
[2020-04-13T16:18:54,556][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [percolator]
[2020-04-13T16:18:54,557][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [reindex]
[2020-04-13T16:18:54,557][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [transport-netty3]
[2020-04-13T16:18:54,557][INFO ][o.e.p.PluginsService     ] [DCdtI8f] loaded module [transport-netty4]
[2020-04-13T16:18:54,557][INFO ][o.e.p.PluginsService     ] [DCdtI8f] no plugins loaded
[2020-04-13T16:18:57,031][INFO ][o.e.d.DiscoveryModule    ] [DCdtI8f] using discovery type [zen]
[2020-04-13T16:18:57,774][INFO ][o.e.n.Node               ] initialized
[2020-04-13T16:18:57,775][INFO ][o.e.n.Node               ] [DCdtI8f] starting ...
[2020-04-13T16:18:58,013][INFO ][o.e.t.TransportService   ] [DCdtI8f] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2020-04-13T16:19:01,128][INFO ][o.e.c.s.ClusterService   ] [DCdtI8f] new_master {DCdtI8f}{DCdtI8fZRJu1RpF5q-LW3A}{pI96gxraRiy1k1K3cQnj2Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)[, ]
[2020-04-13T16:19:01,168][INFO ][o.e.h.n.Netty4HttpServerTransport] [DCdtI8f] publish_address 
{127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2020-04-13T16:19:01,169][INFO ][o.e.n.Node               ] [DCdtI8f] started
[2020-04-13T16:19:01,174][INFO ][o.e.g.GatewayService     ] [DCdtI8f] recovered [0] indices into cluster_state

But accessing localhost:9200 is showing ERR_EMPTY_RESPONSE .

There is a security warning after building though since I build from Windows: “building Docker image from Window against non-Windows Docker host”

But the file that I copy has the same privileges in the warning: enter image description here

What could be the problem here?