Security error in kibana container

Take a look at this answer from StackOverflow, it might help:

One other thing, when you are generating the certificates you are passing parameters like --dns elasticsearch01, but I think your internal docker name resolution will create containers with hostnames like john_es01 (it will take it from the container_name of each service in your docker-compose file).

I think the problem here is Kibana is expecting your cert file to be in PEM format, but it is not. What is the content of the config/certs/kibana.crt file?

This is another thread where the user got the exactly the same error you are getting in Kibana: