Docker-compose ELK

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:


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:

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." -

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

  1. docker-compose.yml
    - 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.

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