ElasticSearch 7.15.0 not working in Pipelines

For some reason, using the elastic/elasticsearch:7.15.0 docker image in Gitlab pipelines does not seem to work. The health check fails, and even if I added a 30 second wait, I am unable to connect to port 9200.

My CI file looks like this:

    - name: elastic/elasticsearch:7.15.0
      command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
      alias: elasticsearch

The strange thing, however, is that it works perfectly fine when I use elastic/elasticsearch:7.1.1. Sadly, this is not an option for me because I need certain features from 7.15.

Am I overlooking something? Is this something I can fix or is this somehow an issue with Gitlab?

I am getting the following output:

Starting service elastic/elasticsearch:7.15.0 ...
Pulling docker image elastic/elasticsearch:7.15.0 ...
Using docker image sha256:53ecd52afaa07a76b74eab63152a65d860f1e8e54d0f5d93c37b18fc80eb9e26 for elastic/elasticsearch:7.15.0 with digest docker.elastic.co/elasticsearch/elasticsearch@sha256:6ae227c688e05f7d487e0cfe08a5a3681f4d60d006ad9b5a1f72a741d6091df1 ...
Waiting for services to be up and running...
*** WARNING: Service runner-lyg4p7af-project-29830664-concurrent-0-d98cae38f203983b-elastic__elasticsearch-1 probably didn't start properly.
Health check error:
service "runner-lyg4p7af-project-29830664-concurrent-0-d98cae38f203983b-elastic__elasticsearch-1-wait-for-service" timeout
Health check container logs:
Service container logs:

After just 2 days of head scratching I might have a solution to this problem (it works for me):
elasticsearch 7.10.2 still has a Xmx and Xms in the config file, elasticsearch 7.11.0 has not.
So to fix this for 7.11 and higher, you need your CI file to look like this:

    - name: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
      alias: elastic
        - /bin/bash
        - -c
        - echo -Xms256m >> /usr/share/elasticsearch/config/jvm.options && echo -Xmx256m >> /usr/share/elasticsearch/config/jvm.options && /usr/local/bin/docker-entrypoint.sh elasticsearch -Ediscovery.type=single-node

Without this, my kubernetes killed the container because it used too much memory.