Why Kibana in Docker container doesn't work out of the box?

Hi,
I'm trying to run Kibana for the first time. I'm using Docker. Here is my configuration:

version: '3.7'

services:
  elasticsearch:
    image: elasticsearch:5.6.4
    ports:
      - 9200:9200
    environment:
      - discovery.type=single-node
  kibana:
    image: docker.elastic.co/kibana/kibana:5.6.4
    ports:
      - 81:5601
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
      - XPACK_GRAPH_ENABLED=false
      - XPACK_MONITORING_ENABLED=false
      - XPACK_REPORTING_ENABLED=false
      - XPACK_SECURITY_ENABLED=false

What is the expected behavior:
I run it and it works.

What happens instead:
It always shows the Red status and none of Kibana function works:

At the same time, Elasticsearch works fine and I can run any query programmatically.

I can't see any workarounds in the documentation regarding this. I even didn't see any instructions to turn off the xpack. While I turned it off by environment variables, it still tries to run something related to xpack:

What else should be done to make it working? Why it's so unintuitive? Why documentation doesn't cover such simple cases?

Just to confirm, do you have an existing Elasticsearch cluster running 5.6.4 that you're wanting to bring up a Kibana instance to connect to?

If that is not the case, you should really get a more recent version of Elasticsearch/Kibana. That version was released at the end of 2017 and a lot has changed since then. https://www.docker.elastic.co/

If that is the case, then the error is saying you X-Pack is not installed in the Elasticsearch cluster. Either you need to install the x-pack plugin into Elasticsearch, or you need to remove the x-pack plugin from Kibana.

We have an already working stack in production without xpack. So I'm using the same version for local development.

If I use the most recent Kibana version it doesn't work at all, I can't see any UI, just the message Kibana server is not ready yet. In the log, I see the same error:

["warning","plugins","licensing"],"pid":6,"message":"License information could not be obtained from Elasticsearch due to [illegal_argument_exception] No endpoint or operation is available at [_xpack] :: {\"path\":\"/_xpack\",\"statusCode\":400,\"response\":\"{\\\"error\\\":{\\\"root_cause\\\":[{\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"No endpoint or operation is available at [_xpack]\\\"}],\\\"type\\\":\\\"illegal_argument_exception\\\",\\\"reason\\\":\\\"No endpoint or operation is available at [_xpack]\\\"},\\\"status\\\":400}\"} error"}

If I need to remove some plugins, why don't just use an environment variable? Why this case isn't covered here: https://www.elastic.co/guide/en/kibana/current/docker.html? Can I just use an image without custom Dockerfiles to remove something from the official image? My frustration is endless because of the fact that a product at the major version 7 still requires removing something to make it just work... Why not to make two official images with xpack and without to make developers happy and just use the product instead of spending a lot of time for googling? Why the official Elasticsearch image comes without xpack but official Kibana image comes with it and they can not work together without additional manipulations?

The default docker images include our free and open features. If you don't want to use those you can append -oss onto the image name and it will pull only the open source products.

eg docker pull docker.elastic.co/kibana/kibana:7.9.0 is what we consider default. docker pull docker.elastic.co/kibana/kibana-oss:7.9.0 would be the open source only image of the same version. https://www.docker.elastic.co/r/kibana shows you what is available (for all products) on the image front too.

You raise a valid point though, the docker install page doesn't mention this like the other install pages do, so I have raised an issue on GitHub to get that fixed. Apologies for the confusion there.

Thank you for the prompt update. And sorry for my angry writing style.

By the way, I tried to run oss images but none of the available oss images can work with my ES version. The oldest oss image I could find is 6.0.0 but it can't work with ES 5.6.4:

This version of Kibana requires Elasticsearch v6.0.0 on all nodes. I found the following incompatible nodes in your cluster: v5.6.4 @ 172.30.0.4:9200 (127.0.0.1)

So the only chance in my case is to remove the xpack plugin manually, right?

No worries. You may want to be explicit in your dockerfile and use https://www.docker.elastic.co/r/elasticsearch/elasticsearch:5.6.4 and also docker.elastic.co/kibana/kibana:5.6.4, so that they match the source and version.

Is there a reason you cannot upgrade? As mentioned, 5.X reached EOL quite some time ago.

We could migrate but not now. As I'm just taking over this legacy project, I'm setting up an environment to work on. Later we definitely will migrate to a fresh version.