# Elastic search server do not respond on curl request

**URL:** <https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [February 14, 2024, 11:29am UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258 "2024-02-14T11:29:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahram/32/131733_2.png) [@Shahram](https://discuss.elastic.co/u/Shahram)\
**Post date:** [February 14, 2024, 11:29am UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258/1 "2024-02-14T11:29:04Z")

</div>

I noticed my Elasticsearch could not be accessible via curl, so I started from scratch on a new vm.  
I used this config file for docker-compose.yml:

```auto
version: '3.6'
services:
  Elasticsearch:
    image: elasticsearch:7.16.2
    container_name: elasticsearch
    restart: always
    volumes:
    - ./elastic_data:/usr/share/elasticsearch/data/
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      discovery.type: single-node
    ports:
    - '9200:9200'
    - '9300:9300'
    networks:
      - elk

  Logstash:
    image: logstash:7.16.2
    container_name: logstash
    restart: always
    volumes:
    - ./logstash/:/logstash_dir
    command: logstash -f /logstash_dir/logstash.conf
    depends_on:
      - Elasticsearch
    ports:
    - '9600:9600'
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk

  Kibana:
    image: kibana:7.16.2
    container_name: kibana
    restart: always
    ports:
    - '5601:5601'
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
    depends_on:
      - Elasticsearch
    networks:
      - elk
volumes:
  elastic_data: {}

networks:
  elk:

```

With this template of .env file:

```auto
# Project namespace (defaults to the current folder name if not set)
COMPOSE_PROJECT_NAME=es

# Password for the 'elastic' user (at least 6 characters)
ELASTIC_PASSWORD=changeme

# Password for the 'kibana_system' user (at least 6 characters)
KIBANA_PASSWORD=changeme

# Version of Elastic products
#https://www.elastic.co/downloads/past-releases#elasticsearch
STACK_VERSION=8.8.2

# Set the cluster name
CLUSTER_NAME=docker-cluster

# Set to 'basic' or 'trial' to automatically start the 30-day trial
LICENSE=basic
#LICENSE=trial

# Port to expose Elasticsearch HTTP API to the host
ES_PORT=9200

# Port to expose Kibana to the host
KIBANA_PORT=5601

# Port to expose Fleet to the host
FLEET_PORT=8220

# Port to expose APM to the host
APMSERVER_PORT=8200

# APM Secret Token for POC environments only
ELASTIC_APM_SECRET_TOKEN=supersecrettoken

# Increase or decrease based on the available host memory (in bytes)
ES_MEM_LIMIT=3073741824
KB_MEM_LIMIT=1073741824
LS_MEM_LIMIT=1073741824

# SAMPLE Predefined Key only to be used in POC environments
ENCRYPTION_KEY=c34d38b3a14956121ff2170e5030b471551371ff2170ee5626eec58b04a30fae2

```

Then `docker-compose up` and I have all the services running and fine. But I cannot access to the elasticsearch via curl. I tried `curl http://elasticsearch:9200/` and I got `curl: (6) Could not resolve host: elasticsearch` which I guess means name server not found. with `curl 172.19.0.2:9200` I got `curl: (7) Failed to connect to 172.19.0.2 port 9200 after 0 ms: Connection refused` and `curl http://localhost:9200/` responds as `curl: (56) Recv failure: Connection reset by peer`.

Any Idea?

---

<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:** [February 14, 2024, 12:58pm UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258/2 "2024-02-14T12:58:38Z")

</div>

Welcome!

Try:

```
curl -k -u elastic https://127.0.0.1:9200

```

---

<div class="post-metadata">

**Author:** ![Shahram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahram/32/131733_2.png) [@Shahram](https://discuss.elastic.co/u/Shahram)\
**Post date:** [February 14, 2024, 1:24pm UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258/3 "2024-02-14T13:24:08Z")

</div>

Thanks, it is working. So I guess the certificate checking was the point, right?

---

<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:** [February 14, 2024, 4:05pm UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258/4 "2024-02-14T16:05:22Z")

</div>

And also http vs https

---

<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:** [March 13, 2024, 4:05pm UTC](https://discuss.elastic.co/t/elastic-search-server-do-not-respond-on-curl-request/353258/5 "2024-03-13T16:05:46Z")

</div>

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