Elasticsearch.url does not work as an environment variable inside docker-compose

I am running Kibana 6.3.0 inside docker.
However the elasticsearch.url value specified as an environment variable is not picked up when it is specified in docker-compose.yml. In this case Kibana tries to connect to localhost (default value).

docker-compose.yml:

# Kibana
  kibana:
    build:
      context: kibana/
    container_name: ${ES_KIBANA}
    hostname: ${ES_KIBANA}
    environment:
      - server.name=${ES_KIBANA}
      - elasticsearch.url=http://${ES_CLIENT1}:9200
    volumes:
      - ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro
    ports:
      - "5601:5601"
    networks:
      - esnet
    depends_on:
      - client1

If I give the same value in kibana.yml, then in works.
kibana.yml:
elasticsearch.url: http://es-docker-client1:9200

The environment variables in docker-compose.yml are correctly resolved as seen in the output of docker-compose config:

  kibana:
    build:
      context: /home/airvana/docker-elk/kibana
    container_name: es-docker-kibana
    depends_on:
    - client1
    environment:
      elasticsearch.url: http://es-docker-client1:9200
      server.name: es-docker-kibana
    hostname: es-docker-kibana
    networks:
      esnet: null
    ports:
    - published: 5601
      target: 5601
    volumes:
    - /home/airvana/docker-elk/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro

Is this a known issue? Thanks.

@jarpy - can you please help here ? elasticsearch.url in kibana.yml (or ELASTICSEARCH_URL under the environment: section of kibana in the compose file) must be set to the specific IP of the cluster and port 9200 I guess it does not resolve if its set like what you have shown when you run outside of compose. I have pinged my colleague for more insight into this.

Thanks
Rashmi

Aha. Thanks for your tip Rashmi.
I should have been using ELASTICSEARCH_URL instead of elasticsearch.url in the compose file. My bad, it is mentioned in the documentation as well.

Glad that its resolved and thanks for posting back.

Cheers
Rashmi

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