Docker - Logstash - Error => "Elasticsearch Unreachable"

I am trying to install ELK using Docker. I have kibana and Elasticsearch both running just fine. I just to push some logs to logstash and keep getting the error below:

[2018-08-24T22:01:24,787][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch"}

It looks like some DNS issues but I am able to run "curl elasticsearch:9200" from the logstash image without any error.

Below is my docker-compose.yml file:

version: '2.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
    container_name: elasticsearch2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:6.4.0
    container_name: kibana
    environment:
       ELASTICSEARCH_URL: http://elasticsearch:9200
    ulimits:
      memlock:
        soft: -1
        hard: -1
#    volumes:
#     - /root/compose_test/kibana.yml:/usr/share/kibana/config/kibana.yml
    ports: 
      - 5601:5601
    networks:
      - esnet
    depends_on:
      - elasticsearch

  logstash:
    image: docker.elastic.co/logstash/logstash:6.4.0
    container_name: logstash
#    environment:
#       ELASTICSEARCH_URL: http://elasticsearch:9200
    ulimits:
      memlock:
        soft: -1
        hard: -1
    depends_on:
      - elasticsearch
    networks: 
      - esnet

volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local
#  esdata3: 
#    driver: local
networks:
  esnet:

Please help me resolve this issue :pleading_face:

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