简体   繁体   中英

Kibana can't connect to ElasticSearch with docker on Mac M1

Basically I'm trying to setup a environment with elasticsearch and kibana with docker on a m1 mac. I've setup the de env variable DOCKER_DEFAULT_PLATFORM to linux/amd64 . Everything seems fine on running the container but when I try to connect kibana to elastic they just can't see each other. This is my current docker-composer file:


  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3-amd64
    environment:
      - discovery.type=single-node
      - node.name=elasticsearch1
      - cluster.name=docker-cluster
      - cluster.initial_master_nodes=elasticsearch1
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms128M -Xmx128M"
    ports:
      - 9200:9200
    networks:
      - my-network

  kibana:
    image: docker.elastic.co/kibana/kibana:8.3.3-amd64
    environment:
      SERVER_NAME: localhost
      ELASTICSEARCH_URL: http://localhost:9200/
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
    networks:
      - my-network

Before that I was using links insted of networks , no luck with that either. From my terminal or browser I can see both elastic and kibana running on their respective ports. I'm without ideas here, appreciate any help

ELASTICSEARCH_URL: http://localhost:9200/ should be http://my-network:9200/ , localhost can't access elasticsearch container.

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