Elasticsearch password not getting from environment variable in kibana [duplicate]

  docker, docker-compose, elastic-stack, kibana

below is the docker file. I set password in .env variable. However it is not passing the value

working

  kibana:
    image: docker.elastic.co/kibana/kibana:${ELASTIC_STACK_VERSION}
    environment:
      - ELASTICSEARCH_PASSWORD=mypassword

not working

  kibana:
    image: docker.elastic.co/kibana/kibana:${ELASTIC_STACK_VERSION}
    environment:
      - ELASTICSEARCH_PASSWORD=${ES_PWD}

.env

ES_PWD=mypassword

Source: Docker Questions

LEAVE A COMMENT