Error: EACCES: permission denied, open '/usr/share/kibana/cert/elastic-certificates.key'

Hi all,

getting error Error: EACCES: permission denied, open '/usr/share/kibana/cert/elastic-certificates.key'

-----------------inside docker compose ------------

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.1
ports:
- "9200:9200"
environment:
- xpack.security.enabled=true
- discovery.type=single-node
- ES_JAVA_OPTS=-Xmx2g -Xms2g

deploy:
  resources:
    limits:
      memory: 4g  # Set maximum memory limit
    reservations:
      memory: 2g  # Set reserved memory
volumes:
  - ./cert:/usr/share/elasticsearch/cert
  - ./elasticsearch.yml:/usr/share/elasticsearch/elasticsearch.yml

kibana:
image: docker.elastic.co/kibana/kibana:7.17.1
ports:
- "5601:5601"
depends_on:
- elasticsearch
privileged: true
volumes:
- ./cert:/usr/share/kibana/cert
- ./kibana.yml:/usr/share/kibana/config/kibana.yml

-----------kibana.yml file----------------
server.port: 5601

server.host: "0.0.0.0"

elasticsearch.hosts: ["http://localhost:9200"]

server.ssl.enabled: true

server.ssl.certificate: /usr/share/kibana/cert/elastic-certificates.crt

server.ssl.key: /usr/share/kibana/cert/elastic-certificates.key

elasticsearch.username: "elastic"

elasticsearch.password: "password"

-------elastic.yml file---------------
xpack.security.enabled: true

xpack.security.transport.ssl.enabled: true

xpack.security.transport.ssl.verification_mode: certificate

xpack.security.transport.ssl.keystore.path: ./certs/elastic-certificates.p12

xpack.security.transport.ssl.truststore.path: ./certs/elastic-certificates.p12

though my elastic is working as expected with username and password

kibana is giving error -> Error: EACCES: permission denied, open '/usr/share/kibana/cert/elastic-certificates.key'

Thank you in advance.

From Elasticsearch to Kibana