简体   繁体   中英

Unable to launch the elastic search on Apple Mac chip M1 using docker

Before posting this question, I went through many links like: Kibana can't connect to ElasticSearch with docker on Mac M1 and How to run Elasticsearch 6 on an Apple Silicon Mac? , but still things are not working for me.

I've Mac book with chip=Apple M1 Pro and looking to install the elasticsearch by using the below docker-compose.yml file.

version: "3.7"

networks:
 dev-net:
  name: dev-net
  driver: bridge

services:
  elasticsearch:
    platform: linux/amd64
    image: elasticsearch:7.8.0
    container_name: elasticsearch
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      discovery.type: single-node
  kibana:
    platform: linux/amd64
    image: kibana:7.8.0
    container_name: kibana
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch

I am trying to launch the http://localhost:9200, but its not launching at all.

Can someone please guide me on the issue?

docker ps

CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS                                            NAMES
0786eda7236c   kibana:7.8.0          "/usr/local/bin/dumb…"   12 minutes ago   Up 12 minutes   0.0.0.0:5601->5601/tcp                           kibana
973c40079850   elasticsearch:7.8.0   "/tini -- /usr/local…"   12 minutes ago   Up 12 minutes   0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch

If your aim is only to work es in your dev machine you could use this:

miostackoverflow.yml
version: "3.7"
networks:
 dev-net:
  name: dev-net
  driver: bridge
services:
  elasticsearch:    
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0           # this works perfectly fine

    # platform: linux/amd64                                               
    # image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0-amd64   
    container_name: elasticsearch
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - discovery.type=single-node
      # - bootstrap.system_call_filter=false # use to avoid the symptom eception. use it only on the amd64 version
  kibana:
    image: docker.elastic.co/kibana/kibana:7.15.0           # this works perfectly fine

    # platform: linux/amd64                                 
    # image: docker.elastic.co/kibana/kibana:7.15.0-amd64   
    container_name: kibana
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
   

When you use the active versions of the yaml file docker.elastic.co/elasticsearch/elasticsearch:7.15.0 and docker.elastic.co/kibana/kibana:7.15.0

without use the platform container property, it start in less than one minute and you can access to kibana too.

 docker compose -f miostackoverflow.yml up --build --remove-orphans     
 docker compose -f miostackoverflow.yml down -v --remove-orphans  




NOTABENE

If you try to start the amd64 versions (i deactivated these on the yaml) you will get this exception on elastic:

elasticsearch  | {"type": "server", "timestamp": "2022-12-15T11:22:13,750Z", "level": "WARN", "component": "o.e.b.JNANatives", "cluster.name": "docker-cluster", "node.name": "f25ebc3d7cbf", "message": "unable to install syscall filter: ", 
elasticsearch  | "stacktrace": ["java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed",
elasticsearch  | "at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:331) ~[elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:606) ~[elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:248) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:102) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:108) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:399) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:167) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:158) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:114) [elasticsearch-cli-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.Command.main(Command.java:79) [elasticsearch-cli-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:123) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) [elasticsearch-7.15.0.jar:7.15.0]"] }

Anyway i set this in environment to avoid the above error

- bootstrap.system_call_filter=false

It's buggy, slow and you must wait 4 or 5 minutes to start. However even in this case you should be able to access to elastic and kibana

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM