0
votes

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_PLATFORMto 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!

1

1 Answers

0
votes

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