Docker-compose ELK

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

For example: https://github.com/d3rwan/docker_elk_stack/blob/master/kibana/config/kibana.yml

Thanks

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

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

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, and it used to be 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

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