# How to visit elasticsearch in docker in another docker?

**URL:** <https://discuss.elastic.co/t/how-to-visit-elasticsearch-in-docker-in-another-docker/194083>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [August 6, 2019, 6:40pm UTC](https://discuss.elastic.co/t/how-to-visit-elasticsearch-in-docker-in-another-docker/194083 "2019-08-06T18:40:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![riverbuilding](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@riverbuilding](https://discuss.elastic.co/u/riverbuilding)\
**Post date:** [August 6, 2019, 6:40pm UTC](https://discuss.elastic.co/t/how-to-visit-elasticsearch-in-docker-in-another-docker/194083/1 "2019-08-06T18:40:12Z")

</div>

I deploy elasticsearch in docker with below command:

sudo docker run --name es1 -p 6200:9200 -p 6300:9300 -e "xpack.security.enabled=false" -e discovery.type=single-node -e "ES\_JAVA\_OPTS=-Xms2048m -Xmx2048m" [docker.elastic.co/elasticsearch/elasticsearch:5.5.3](http://docker.elastic.co/elasticsearch/elasticsearch:5.5.3)

the host ip where the docker container run is hostip  
the inet addr of docker0 is 172.17.0.1  
docker inpect above ES container and its ip is: 172.17.0.5

I run command in host directly:  
curl -XGET 'hostip:6200'  
then I get result

I run command in another docker which is deployed on the same host with above ES:  
curl -XGET 'hostip:6200'  
nothing get and the visit will timeout

I run command in another docker which is deployed on the same host with above ES:  
curl -XGET '172.17.0.1:6200'  
nothing get and the visit will timeout

I run command in another docker which is deployed on the same host with above ES:  
curl -XGET '172.17.0.5:9200'  
then I get result

I run command in another host which is diff with the host above ES deployed:  
curl -XGET 'hostip:6200'  
then I get result

I run command in another docker which is deployed on the diff host with above ES:  
curl -XGET 'hostip:6200'  
then I get result

so my question is: how can I visit this ES container with hostip:6200 from another container which deployed on the same host ?

--net=host is not the choose under my condition.

---

<div class="post-metadata">

**Author:** ![riverbuilding](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@riverbuilding](https://discuss.elastic.co/u/riverbuilding)\
**Post date:** [August 7, 2019, 1:57pm UTC](https://discuss.elastic.co/t/how-to-visit-elasticsearch-in-docker-in-another-docker/194083/2 "2019-08-07T13:57:29Z")

</div>

can anybody help to take a look at this issue please?

---

<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:** [September 4, 2019, 2:12pm UTC](https://discuss.elastic.co/t/how-to-visit-elasticsearch-in-docker-in-another-docker/194083/3 "2019-09-04T14:12:24Z")

</div>

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