I am trying to have a simple docker-compose with an elastic container and kibana.
In the logs, kibana failed to authenticate to elastic and I can't find why.
version: '3.7'
services:
  elasticsearch:
    container_name: elasticsearch
    hostname: elasticsearch
    image:     "docker.elastic.co/elasticsearch/elasticsearch:7.4.2"
    networks: ['stack']
    environment:
      - cluster.name=es-cluster
      - node.name=es-node-1
      - path.data=/usr/share/elasticsearch/data
      - http.port=9200
      - http.host=0.0.0.0
      - transport.host=127.0.0.1
      -  bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      - xpack.security.enabled=true
      - "ELASTIC_PASSWORD=MySuperPassword"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - api_esdata1:/usr/share/elasticsearch/data
    ports:
      - '9200:9200'
    healthcheck:
      test: ["CMD", "curl","-s" ,"-f", "http://localhost:9200/_cat/health"]
  kibana:
    image: "docker.elastic.co/kibana/kibana:7.4.2"
    container_name: kibana
    environment:
      - "ELASTICSEARCH_PASSWORD=MySuperPassword"
    volumes:
      - ./kibana/config/kibana.yml:/usr/share/kibana/kibana.yml
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
    networks: ['stack']
volumes:
  api_esdata1:
    external: true
networks: {stack: {}}
and here is my ./kibana/config/kibana.yml
server.host: "0"
server.port: 127.0.0.1:5601
elasticsearch.url: "http://elasticsearch:9200"
server.name: "elastic-stack"
The elastic password works well, the problem is only on kibana, I have this error in the logs :
{"type":"log","@timestamp":"2019-11-29T09:52:53Z","tags":["status","plugin:graph@7.4.2","error"],"pid":6,"state":"red","message":"Status changed from yellow to red - [security_exception] missing authentication credentials for REST reques
t [/_nodes?filter_path=nodes..version%2Cnodes..http.publish_address%2Cnodes.*.ip], with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } }","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
Also later :
{"type":"log","@timestamp":"2019-11-29T09:52:55Z","tags":["license","warning","xpack"],"pid":6,"message":"License information from the X-Pack plugin could not be obtained from Elasticsearch for the [data] cluster. [security_exception] mi
ssing authentication credentials for REST request [/_xpack], with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } } :: {"path":"/xpack","statusCode":401,"response":"{\"error\":{\"root
cause\":[{\"type\":\"security_exception\",\"reason\":\"missing authentication credentials for REST request [/_xpack]\",\"header\":{\"WWW-Authenticate\":\"Basic realm=\\\"security\\\" charset=\\\"UT
F-8\\\"\"}}],\"type\":\"security_exception\",\"reason\":\"missing authentication credentials for REST request [/_xpack]\",\"header\":{\"WWW-Authenticate\":\"Basic realm=\\\"security\\\" charset=\
\\"UTF-8\\\"\"}},\"status\":401}","wwwAuthenticateDirective":"Basic realm=\"security\" charset=\"UTF-8\""}"}
What is wrong ? Thank you