# Cannot access to localhost but node has started

**URL:** <https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [April 30, 2020, 7:49am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492 "2020-04-30T07:49:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [April 30, 2020, 7:49am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/1 "2020-04-30T07:49:03Z")

</div>

Cannot access to localhost to check Elasticsearch status

Have already tried switching off the firewall. Still the same result. Currently running in docker in WS 2016 server. Elasticsearch 7.6.2.

Here is the log

```auto
[2020-04-30T15:37:25,534][INFO][o.e.x.s.a.s.FileRolesStore] [node1] parsed [0] roles from file [C:\elasticsearch-7.6.2\config\roles.yml]
[2020-04-30T15:37:26,290][INFO][o.e.x.m.p.l.CppLogMessageHandler] [node1] [controller/4844] [Main.cc@110] controller (64 bit): Version 7.6.2 (Build e06ef9d86d5332) Copyright (c) 2020 Elasticsearch BV
[2020-04-30T15:37:27,684][DEBUG][o.e.a.ActionModule] [node1] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-30T15:37:27,834][INFO][o.e.d.DiscoveryModule] [node1] using discovery type [zen] and seed hosts providers [settings]
[2020-04-30T15:37:28,731][INFO][o.e.n.Node] [node1] initialized
[2020-04-30T15:37:28,731][INFO][o.e.n.Node] [node1] starting ...
[2020-04-30T15:37:28,931][INFO][o.e.t.TransportService] [node1] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2020-04-30T15:37:29,195][INFO][o.e.c.c.Coordinator] [node1] setting initial configuration to VotingConfiguration{qUi8ELbeSguh3aL0jf-x_A}
[2020-04-30T15:37:29,500][INFO][o.e.c.s.MasterService] [node1] elected-as-master ([1] nodes joined)[{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_open_jobs=20} elect
 leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_op
en_jobs=20}]}
[2020-04-30T15:37:29,589][INFO][o.e.c.c.CoordinationState] [node1] cluster UUID set to [7J3uhKsjR-6rAlcAL2v_xA]
[2020-04-30T15:37:29,657][INFO][o.e.c.s.ClusterApplierService] [node1] master node changed {previous [], current [{node1}{qUi8ELbeSguh3aL0jf-x_A}{2H8C4oRxRUyUfCk0fjEQ0g}{127.0.0.1}{127.0.0.1:9300}{dlm}{ml.machine_memory=8589328384, xpack.installed=true, ml.max_open_jobs
=20}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
[2020-04-30T15:37:30,421][INFO][o.e.h.AbstractHttpServerTransport] [node1] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2020-04-30T15:37:30,421][INFO][o.e.n.Node] [node1] started
[2020-04-30T15:37:31,383][INFO][o.e.g.GatewayService] [node1] recovered [0] indices into cluster_state
[2020-04-30T15:37:31,695][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.watch-history-10] for index patterns [.watcher-history-10*]
[2020-04-30T15:37:31,877][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.watches] for index patterns [.watches*]
[2020-04-30T15:37:31,966][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2020-04-30T15:37:32,059][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [ilm-history] for index patterns [ilm-history-1*]
[2020-04-30T15:37:32,158][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.slm-history] for index patterns [.slm-history-1*]
[2020-04-30T15:37:32,269][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-7-*]
[2020-04-30T15:37:32,412][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-es] for index patterns [.monitoring-es-7-*]
[2020-04-30T15:37:32,535][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-beats] for index patterns [.monitoring-beats-7-*]
[2020-04-30T15:37:32,660][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-alerts-7] for index patterns [.monitoring-alerts-7]
[2020-04-30T15:37:32,742][INFO][o.e.c.m.MetaDataIndexTemplateService] [node1] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-7-*]
[2020-04-30T15:37:32,824][INFO][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [watch-history-ilm-policy]
[2020-04-30T15:37:33,133][INFO][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [slm-history-ilm-policy]
[2020-04-30T15:37:33,199][INFO][o.e.x.i.a.TransportPutLifecycleAction] [node1] adding index lifecycle policy [ilm-history-ilm-policy]
[2020-04-30T15:37:33,358][INFO][o.e.l.LicenseService] [node1] license [49e9e84b-d3a1-49e0-a0d1-e44f7c7cda20] mode [basic] - valid
[2020-04-30T15:37:33,358][INFO][o.e.x.s.s.SecurityStatusChangeListener] [node1] Active license is now [BASIC]; Security is disabled 

```

Here is my elasticsearch.yml file

```auto
network.host: _local_

cluster.name: elasticsearch
cluster.initial_master_nodes: node1

node.master: true
node.data: true
node.ingest: false
node.name: node1

path.logs: C:\Elasticsearch\data
path.data: C:\Elasticsearch\logs
discovery.seed_hosts: 127.0.0.1, [::1]
http.port: 9200  

```

Would really appreciate the advice

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 30, 2020, 8:05am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/2 "2020-04-30T08:05:53Z")

</div>

How do you start it?

---

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [April 30, 2020, 8:19am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/3 "2020-04-30T08:19:57Z")

</div>

I use this command to start it

`docker run --rm -p 9200:9200 -p 9300:9300 <imageid>`

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 30, 2020, 8:32am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/4 "2020-04-30T08:32:30Z")

</div>

> [@yummycake](#):
>
> Cannot access to localhost to check Elasticsearch status

How are you checking this?

Do you have a corporate proxy by any chance?

---

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [April 30, 2020, 8:39am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/5 "2020-04-30T08:39:44Z")

</div>

Nope I dont have any corporate proxy, I am currently doing this on my local server.

I tried to access localhost:9200 through browser and also tried using curl but failed to see the Elasticsearch status. It's weird cause the log said it is already started.

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 30, 2020, 9:11am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/6 "2020-04-30T09:11:20Z")

</div>

What happens if you do a `curl http://localhost:9200` inside the container?  
Use `docker exec -it <container id> /bin/bash` then run the `curl` command.

I think you should remove `network.host: _local_` at least when running on Docker.

---

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [April 30, 2020, 9:36am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/7 "2020-04-30T09:36:08Z")

</div>

After I ran this command

`docker exec -it 4db451a8eab4 /bin/bash curl http://localhost:9200`

I got this prompted

```auto
container 4db451a8eab4f51a3f49cf8a50036124847a988ff96b59989f7b2ab103e47506 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"/bin/bash curl http://localhost:9200","WorkingDirectory":"/","Environment":{"ELASTICSEARCH_HOME":"C:\\elasticsearch 7.6.2"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

```

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 30, 2020, 10:35am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/8 "2020-04-30T10:35:56Z")

</div>

Run first `docker exec -it 4db451a8eab4 /bin/bash`

Once you're inside the container, run `curl http://localhost:9200`

---

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [May 2, 2020, 3:55am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/9 "2020-05-02T03:55:39Z")

</div>

Sorry for the late reply.

When I did this  
`docker exec -it 4db451a8eab4 /bin/bash`  
It gives me this error still

```auto
container 4db451a8eab4f51a3f49cf8a50036124847a988ff96b59989f7b2ab103e47506 encountered an error during CreateProcess: failure in a Windows system call:
The system cannot find the file specified.
(0x2) extra info: {"CommandLine":"/bin/bash curl http://localhost:9200","WorkingDirectory":"/","Environment":{"ELASTICSEARCH_HOME":"C:\\elasticsearch 7.6.2"},
"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[0,0]}

```

**Update** : I edited the network host to 0.0.0.0

I can see the Elasticsearch status on web browse and curl if i input the publish\_address. However, when I try to curl [http://localhost:9200](http://localhost:9200) it still doesn't show the status.

Does this mean its working correctly?

---

<div class="post-metadata">

**Author:** ![yummycake](https://avatars.discourse-cdn.com/v4/letter/y/2acd7d/32.png) [@yummycake](https://discuss.elastic.co/u/yummycake)\
**Post date:** [May 3, 2020, 6:16am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/10 "2020-05-03T06:16:39Z")

</div>

Perhaps, I got the error because I installed ES for windows

Here is my dockerfile if this helps

```auto
FROM mcr.microsoft.com/windows/servercore:ltsc2016 

# Build variable to allow passing in a specific version of ElasticSearch
ARG ELASTICSEARCH_VERSION=7.6.2
ARG ELASTICSEARCH_SOURCE=elasticsearch-${ELASTICSEARCH_VERSION}
ARG ELASTICSEARCH_ZIP=elasticsearch-${ELASTICSEARCH_VERSION}-windows-x86_64.zip

# Copy apps from sources to root directory
COPY sources /

RUN powershell -Command \
	#Extracts the zip to a folder then delete the zip
	Expand-Archive -Path $env:ELASTICSEARCH_ZIP -DestinationPath C:\; \
	Remove-Item -Path $env:ELASTICSEARCH_ZIP

	

# ELASTICSEARCH_HOME is used by RunElasticSearch.cmd file to launch ElasticSearch.
ENV ELASTICSEARCH_HOME C:\\${ELASTICSEARCH_SOURCE}

# Copy config files
COPY elasticsearch.yml ${ELASTICSEARCH_HOME}/config/

# Call file to start ELASTICSEARCH
CMD ["C:/RunElasticSearch.cmd"]

EXPOSE 9200 9300

```

Thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 31, 2020, 6:16am UTC](https://discuss.elastic.co/t/cannot-access-to-localhost-but-node-has-started/230492/11 "2020-05-31T06:16:43Z")

</div>

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