1

Launching a container using docker run -it -p 9200:9200 -p 9300:9300 elasticsearch

/local/elasticsearch/bin/elasticsearch: line 184: hostname: command not found
[2018-01-31T07:13:47,062][INFO ][o.e.n.Node               ] [] initializing ...
[2018-01-31T07:13:47,190][INFO ][o.e.e.NodeEnvironment    ] [7l2eIAu] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [9.2gb], net total_space [9.9gb], spins? [unknown], types [rootfs]
[2018-01-31T07:13:47,190][INFO ][o.e.e.NodeEnvironment    ] [7l2eIAu] heap size [1.9gb], compressed ordinary object pointers [true]
[2018-01-31T07:13:47,192][INFO ][o.e.n.Node               ] node name [7l2eIAu] derived from node ID [7l2eIAucSYmZ6CCHrtOZkg]; set [node.name] to override
[2018-01-31T07:13:47,194][INFO ][o.e.n.Node               ] version[5.5.0], pid[1], build[260387d/2017-06-30T23:16:05.735Z], OS[Linux/3.10.0-693.11.6.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_161/25.161-b14]
[2018-01-31T07:13:47,194][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -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=/local/elasticsearch]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [aggs-matrix-stats]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [ingest-common]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-expression]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-groovy]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-mustache]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-painless]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [parent-join]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [percolator]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [reindex]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [transport-netty3]
[2018-01-31T07:13:48,846][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [transport-netty4]
[2018-01-31T07:13:48,846][INFO ][o.e.p.PluginsService     ] [7l2eIAu] no plugins loaded
[2018-01-31T07:13:51,816][INFO ][o.e.d.DiscoveryModule    ] [7l2eIAu] using discovery type [zen]
[2018-01-31T07:13:52,824][INFO ][o.e.n.Node               ] initialized
[2018-01-31T07:13:52,824][INFO ][o.e.n.Node               ] [7l2eIAu] starting ...
[2018-01-31T07:13:53,014][INFO ][o.e.t.TransportService   ] [7l2eIAu] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2018-01-31T07:13:53,027][WARN ][o.e.b.BootstrapChecks    ] [7l2eIAu] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-01-31T07:13:56,091][INFO ][o.e.c.s.ClusterService   ] [7l2eIAu] new_master {7l2eIAu}{7l2eIAucSYmZ6CCHrtOZkg}{N4Npv8ZCQZe8NSQ7yr1BgQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2018-01-31T07:13:56,144][INFO ][o.e.h.n.Netty4HttpServerTransport] [7l2eIAu] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2018-01-31T07:13:56,144][INFO ][o.e.n.Node               ] [7l2eIAu] started
[2018-01-31T07:13:56,160][INFO ][o.e.g.GatewayService     ] [7l2eIAu] recovered [0] indices into cluster_state
========================================================

Inside the container I am able to access Elasticsearch using curl.

[elasticsearch@df69f59c016f /]$ curl localhost:9200

{
  "name" : "7l2eIAu",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "FEhCecNWRuOi7qCynVmTrw",
  "version" : {
    "number" : "5.5.0",
    "build_hash" : "260387d",
    "build_date" : "2017-06-30T23:16:05.735Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}
==========================================

But when I try to curl it from outside the container, I receive the error below.

[root@ip-20-0-0-86 ~]# curl localhost:9200
curl: (56) Recv failure: Connection reset by peer
[root@ip-20-0-0-86 ~]# curl localhost:9300
curl: (56) Recv failure: Connection reset by peer
[root@ip-20-0-0-86 ~]# curl 127.0.0.1:9300
curl: (56) Recv failure: Connection reset by peer
  • What is the docker image you are using for elasticsearch? You get an error message about the hostname-command is not found, so my thoughts is that something could be wrong with the image. – pkhamre Jan 31 '18 at 10:45
  • Have you tried add the option --network.host _non_loopback_ ? github.com/docker-library/elasticsearch/issues/50 – Alexander Makarenko Jan 31 '18 at 12:02
  • I am on version 5.5 , option --network.host _non_loopback looks for version 2.0. – Shuaib Shaikh Feb 1 '18 at 7:58
  • Do we need to install elasticsearch plugin to access ElasticsearchV 5.5 – Shuaib Shaikh Feb 2 '18 at 5:35
0

The publish_address is configured to localhost with your setup: 127.0.0.1:9200.

You can change the corresponding setting like this when starting up the Elasticsearch container:

docker run -p 9200:9200 elasticsearch -Ehttp.host=0.0.0.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.