# Caused by: java.net.UnknownHostException: fx-elasticsearch: Name does not resolve

**URL:** <https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [July 26, 2021, 7:20am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596 "2021-07-26T07:20:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MdRashid](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MdRashid](https://discuss.elastic.co/u/MdRashid)\
**Post date:** [July 26, 2021, 7:20am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/1 "2021-07-26T07:20:49Z")

</div>

Hi All,

I have issue of fx-elasticsearch not found and i have deploy as docker compose file

one more error i got in same container

```auto
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchClient' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.IllegalArgumentException: java.net.UnknownHostException: fx-elasticsearch: Name does not resolve

```

here is the elasticsearch.yml file

```auto
http.host: 0.0.0.0

# Uncomment the following lines for a production cluster deployment
transport.host: 0.0.0.0
#discovery.zen.minimum_master_nodes: 1
#transport.host: localhost
#transport.tcp.port: 9300
#http.port: 9200
#network.bind_host: 0.0.0.0

```

and here is docker-compose file

```auto
fx-elasticsearch:
# image: "elasticsearch:5.0.0"
    image: "elasticsearch:6.8.12"
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == manager]
      resources:
        limits:
          memory: 10G
    environment:
      - ES_JAVA_OPTS=${ELASTICSEARCH_MEM}
      - ./elasticsearch.yaml:/usr/share/elasticsearch/config/elasticsearch.yml
      - cluster.name=elasticsearch
    volumes:
      - esdata:/usr/share/elasticsearch/data
    logging:
      driver: syslog
      options:
        tag: "{{.Name}}/{{.ID}}"

```

Here is my .env file

```auto
ELASTICSEARCH_HOST=fx-elasticsearch
ELASTICSEARCH_MEM="-Xms4g -Xmx4g"

```

Please help out

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 26, 2021, 7:25am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/2 "2021-07-26T07:25:25Z")

</div>

Can you `ping fx-elasticsearch`? If not then you have a DNS issue in your network.

---

<div class="post-metadata">

**Author:** ![MdRashid](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MdRashid](https://discuss.elastic.co/u/MdRashid)\
**Post date:** [July 26, 2021, 7:28am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/3 "2021-07-26T07:28:00Z")

</div>

where should i ping inside elasticsearch container

---

<div class="post-metadata">

**Author:** ![MdRashid](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MdRashid](https://discuss.elastic.co/u/MdRashid)\
**Post date:** [July 26, 2021, 7:29am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/4 "2021-07-26T07:29:59Z")

</div>

> [@warkolm](#):
>
> `ping fx-elasticsearch`

inside docker container of elasticsearch its pinging ..its working and next step plse

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 26, 2021, 7:32am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/5 "2021-07-26T07:32:10Z")

</div>

Ok but you need to be able to do that from outside the container and have it work.

---

<div class="post-metadata">

**Author:** ![MdRashid](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MdRashid](https://discuss.elastic.co/u/MdRashid)\
**Post date:** [July 26, 2021, 7:33am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/6 "2021-07-26T07:33:58Z")

</div>

outside container getting below error...

ping ping fx-elasticsearch  
ping: fx-elasticsearch: Temporary failure in name resolution

i have open port number 9200 in azure vm

---

<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:** [August 23, 2021, 7:34am UTC](https://discuss.elastic.co/t/caused-by-java-net-unknownhostexception-fx-elasticsearch-name-does-not-resolve/279596/7 "2021-08-23T07:34:51Z")

</div>

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