My Docker Elasticsearch Keeps Failing Looking For JAVA?

Good Day,

I'm trying to stand up a demo / test install of ES on Docker for Mac. I have a M1 (ARM) MacBook.

When I try to do the docker compose up I get the following error...

Attaching to elasticsearch, kibana
elasticsearch | Error: could not find libjava.so
elasticsearch | Error: Could not find Java SE Runtime Environment.
elasticsearch exited with code 2

I have Java installed and even set the JAVA_HOME variable... (My Terminal)
cedricgaines@MyM1Air ESTest % java -version
java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

and when I echo JAVA_HOME...
cedricgaines@MyM1Air ESTest % echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home

Here is the content of my simple docker-compose.yml file...
`
version: "3.1"

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.5.1
    container_name: elasticsearch
    environment:
      - xpack.security.enabled = false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add: 
        - IPC_LOCK
    volumes:
      - elasticsearch-data-volume:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300

  kibana:
    image: docker.elastic.co/kibana/kibana:6.5.1
    container_name: kibana
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
  
volumes:
  elasticsearch-data-volume:
        driver: local

`

What Am I Overlooking...

Thanks

1 Like

Hi Cedric,
Elasticsearch running in docker won't use your locally installed jvm, but rather the one which is bundled in the docker image provided by Elastic.
And AFAIK arm architecture is not available in official docker image before 7.?
Take a look at elasticsearch | Docker @ Elastic and put a arm-compatible image version in your docker-compose file.
If you need precisely version 6.5.1, it's better to get the zipped elasticsearch version, install and run it on your local jvm.
enjoy !

1 Like

That was my thoughts as well.

You are awesome!!! I tried a later version of an ES image 7.x and it worked 100% Then i went to my Windows Machine with Docker Desktop and WSL 2 and ran my test compose file with 6.5.1 and it worked as expected.

Thanks a lot

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.