# Docker-compose ELK

**URL:** <https://discuss.elastic.co/t/docker-compose-elk/101858>\
**Category:** Kibana\
**Created:** [September 26, 2017, 2:08pm UTC](https://discuss.elastic.co/t/docker-compose-elk/101858 "2017-09-26T14:08:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.elastic.co/u/Fei_Yao)\
**Post date:** [September 26, 2017, 2:08pm UTC](https://discuss.elastic.co/t/docker-compose-elk/101858/1 "2017-09-26T14:08:28Z")

</div>

Hi,  
When running ELK in docker-compose environment I'm curious why Kibana url refers to "[http://elasticsearch:9200](http://elasticsearch:9200)"? instead of just "[http://localhost:9200](http://localhost:9200)"?

For example: [https://github.com/d3rwan/docker\_elk\_stack/blob/master/kibana/config/kibana.yml](https://github.com/d3rwan/docker_elk_stack/blob/master/kibana/config/kibana.yml)

Thanks

---

<div class="post-metadata">

**Author:** ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)\
**Post date:** [September 26, 2017, 4:21pm UTC](https://discuss.elastic.co/t/docker-compose-elk/101858/2 "2017-09-26T16:21:16Z")

</div>

The Kibana Docker container is only running Kibana, so Elasticsearch would not be on the same machine. `elasticsearch` is the default for docker, similar to how `localhost` is the default elsewhere. The containers alias is also mapped through DNS. Here is an example: [https://github.com/elastic/stack-docker/blob/master/docker-compose.yml](https://github.com/elastic/stack-docker/blob/master/docker-compose.yml)

---

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.elastic.co/u/Fei_Yao)\
**Post date:** [September 26, 2017, 6:17pm UTC](https://discuss.elastic.co/t/docker-compose-elk/101858/3 "2017-09-26T18:17:44Z")

</div>

Thanks, it appears that this is how docker-compose works for networking.

"Other containers on the same network can use either the service name or this alias to connect to one of the service's containers." - [docs.docker.com](https://docs.docker.com/compose/compose-file/compose-file-v2/#aliases)

In order to test it out I made the following changes:

1. docker-compose.yml  
networks:  
elk:  
aliases:  
- elastic
2. kibana.yml  
elasticsearch.url: [http://elastic:9200](http://elastic:9200), and it used to be [http://elasticsearch:9200](http://elasticsearch:9200) (it works because it is the service name that container can reference.)

After `docker-compose up` it still works like charm.  
Thanks

---

<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:** [October 24, 2017, 6:29pm UTC](https://discuss.elastic.co/t/docker-compose-elk/101858/4 "2017-10-24T18:29:32Z")

</div>

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