Not able to setup elasticsearch using docker

I am following this
to setup elastic search.
But it is not working.
Console output
Screenshot%20(135)

when I visit localhost:9200 it say's site cant be reached.

I am on windows 10

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with </> icon. Check the preview window.

[PKNwnkC] heap size [1007.3mb], compressed ordinary object pointers [true][2019-01-14T21:19:32,856][INFO ][o.e.n.Node] [PKNwnkC] node name derived from node ID [PKNwnkCbQgacLfxI8cMceQ]; set [node.name] to override[2019-01-14T21:19:32,858][INFO ][o.e.n.Node] [PKNwnkC] version[6.5.4], pid[1], build[default/tar/d2ef93d/2018-1217T21:17:40.758843Z], OS[Linux/4.14.92boot2docker/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13][2019-01-14T21:19:32,859][INFO ][o.e.n.Node] [PKNwnkC] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.sEsoDW8A, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-01-14T21:19:41,831][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [aggs-matrix-stats][2019-01-14T21:19:41,832][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [analysis-common][2019-01-14T21:19:41,833][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [ingest-common][2019-01-14T21:19:41,833][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [lang-expression][2019-01-14T21:19:41,835][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [lang-mustache][2019-01-14T21:19:41,837][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [lang-painless][2019-01-14T21:19:41,841][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [mapper-extras][2019-01-14T21:19:41,842][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [parent-join][2019-01-14T21:19:41,842][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [percolator][2019-01-14T21:19:41,844][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [rank-eval][2019-01-14T21:19:41,844][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [reindex][2019-01-14T21:19:41,846][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [repository-url][2019-01-14T21:19:41,849][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [transport-netty4][2019-01-14T21:19:41,850][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [tribe][2019-01-14T21:19:41,853][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-ccr][2019-01-14T21:19:41,854][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-core][2019-01-14T21:19:41,855][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-deprecation][2019-01-14T21:19:41,857][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-graph][2019-01-14T21:19:41,857][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-logstash][2019-01-14T21:19:41,858][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-ml][2019-01-14T21:19:41,859][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-monitoring][2019-01-14T21:19:41,860][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-rollup][2019-01-14T21:19:41,862][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-security][2019-01-14T21:19:41,863][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-sql][2019-01-14T21:19:41,864][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-upgrade][2019-01-14T21:19:41,865][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded module [x-pack-watcher][2019-01-14T21:19:41,874][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded plugin [ingest-geoip][2019-01-14T21:19:41,875][INFO ][o.e.p.PluginsService ] [PKNwnkC] loaded plugin [ingest-user-agent][2019-01-14T21:20:03,822][INFO ][o.e.x.s.a.s.FileRolesStore] [PKNwnkC] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml][2019-01-14T21:20:06,241][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [PKNwnkC] [controller/72] [Main.cc@109] controller (64 bit): Version 6.5.4 (Build b616085ef32393) Copyright (c) 2018 Elasticsearch BV[2019-01-14T21:20:08,749][INFO ][o.e.d.DiscoveryModule ] [PKNwnkC] using discovery type [single-node] and host providers [settings][2019-01-14T21:20:12,474][INFO ][o.e.n.Node ] [PKNwnkC] initialized[2019-01-14T21:20:12,475][INFO ][o.e.n.Node ] [PKNwnkC] starting ...[2019-01-14T21:20:13,180][INFO ][o.e.t.TransportService ] [PKNwnkC] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300} [2019-01-14T21:20:13,258][WARN ][o.e.b.BootstrapChecks ] [PKNwnkC] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [2019-01-14T21:20:13,380][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [PKNwnkC] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200} [2019-01-14T21:20:13,383][INFO ][o.e.n.Node ] [PKNwnkC] started [2019-01-14T21:20:13,895][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [PKNwnkC] Failed to clear cache for realms [[]][2019-01-14T21:20:14,223][INFO ][o.e.g.GatewayService ] [PKNwnkC] recovered [0] indices into cluster_state[2019-01-14T21:20:15,037][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.watch-history-9] for index patterns [.watcher-history-9*][2019-01-14T21:20:15,420][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.triggered_watches] for index patterns [.triggered_watches*][2019-01-14T21:20:15,731][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.watches] for index patterns [.watches*][2019-01-14T21:20:16,081][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*][2019-01-14T21:20:16,485][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*][2019-01-14T21:20:16,771][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6][2019-01-14T21:20:17,162][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*][2019-01-14T21:20:17,450][INFO ][o.e.c.m.MetaDataIndexTemplateService] [PKNwnkC] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*][2019-01-14T21:20:18,787][INFO ][o.e.l.LicenseService ] [PKNwnkC] license [9817588d-446a-4b6a-92a3-87be2bd93744] mode [basic] - valid

It seems to be ok. Did you expose your 9200 port so you can access elasticsearch from outside docker ?

I ran docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.5.4
It's exposing host port with container port(p flag) I guess :sweat_smile:

I suspect a problem with the (pretty complex) forwarding that has to happen on Windows. There's a whole extra layer of packet handling to get the packets inside the Linux virtual machine before they even think about getting to the container.

Are you able to run another service on that port? Like:

docker run --rm -it -p 9200:80 nginx

If that doesn't work, try temporarily disabling Windows Firewall.

docker run --rm -it -p 9200:80 nginx
nginx is also not working. I also tried by turning off firewall, changing nginx port still it's not working.

It's working now. I am on docker toolbox.
So instead of localhost:9200 It runs at http://192.168.99.100:9200/
:smiley:

1 Like

Great! (Sorry you are stuck on Docker Toolbox, I get it). :slight_smile: