title: Why am I getting "No alive nodes found in your cluster" using Laravel and Docker?
body: <p>I try to set up elasticsearch on laravel project using the docker and babenkoivan/scout-elasticsearch-driver. 
  When I start docker, all containers working include elasticsearch, but when I try to use </p>
  
  <pre><code>php artisan elastic:create-index "App\TutorialIndexConfigurator"
  </code></pre>
  
  <p>I get an error: </p>
  
  <pre><code>No alive nodes found in your cluster
  </code></pre>
  
  <p>Also, when I try to access to port 9200 via curl from docker workspace container, I get </p>
  
  <pre><code>curl: (7) Failed to connect to localhost port 9200: Connection refused
  </code></pre>
  
  <p>but when I do the same think from terminal, I get information about docker elasticsearch cluster. I think it's maybe related. </p>
  
  <p>I wasted a three day for this problem and I don't have any solution, please help.</p>
  
  <p>I tried to do the same things from laradock and gate the same results.</p>
  
  <p>Here is my docker-compose.yml content</p>
  
  <pre><code>version: '3.1'
  
  #volumes:
  #  elasticsearch:
  #    driver: local
  
  volumes:
    esdata1:
      driver: local
    esdata2:
      driver: local
    esdata3:
      driver: local
  
  networks:
    esnet:
    frontend:
    backend:
  
  services:
    nginx:
      image: nginx
      ports:
          - "80:80"
          - "443:443"
      volumes:
        - ./hosts:/etc/nginx/conf.d
        - ./www:/var/www
        - ./logs:/var/log/nginx
      links:
        - php
      networks:
        esnet:
        frontend:
          aliases:
            - api.dev
        backend:
          aliases:
            - api.dev
  
    mysql:
      image: mysql:5.7
  
      ports: 
      - "3306:3306"
  
      volumes:
        - ./mysql:/var/lib/mysql
  
      environment:
          MYSQL_ROOT_PASSWORD: secret
  
      networks:
        - esnet
        - frontend
        - backend
  
    # postgres:
    #   image: postgres
  
    #   ports: 
    #     - "3306:3306"
  
    #   environment:
    #       MYSQL_ROOT_PASSWORD: secret
  
    adminer:
      image: adminer
      restart: always
      ports:
        - 8080:8080
  
    php:
      build: ./images/php
  
      links:
        - mysql
  
      volumes:
        - ./www:/var/www
  
      networks:
        - esnet
        - frontend
        - backend
  
    workspace:
        build: ./images/workspace
        volumes:
          - ./www:/var/www:cached
        extra_hosts:
          - "dockerhost:10.0.75.1"
        ports:
          - "2222:22"
        tty: true
        networks:
          - esnet
          - frontend
          - backend
  
    redis:
      image: redis:latest
  
      volumes:
            - ./www/redis:/data
  
      ports:
        - "6379:6379"
  
  
    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2
      container_name: elasticsearch
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        - http.cors.enabled=true
        - http.cors.allow-origin=*
        - discovery.zen.minimum_master_nodes=2
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata1:/usr/share/elasticsearch/data
      ports:
        - 9200:9200
      networks:
        - esnet
        - frontend
        - backend
  
    lasticsearch2:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2
      container_name: elasticsearch2
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        - "discovery.zen.ping.unicast.hosts=elasticsearch"
        - http.cors.enabled=true
        - http.cors.allow-origin=*
        - discovery.zen.minimum_master_nodes=2
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata2:/usr/share/elasticsearch/data
      networks:
        - esnet
        - frontend
        - backend
  
    elasticsearch3:
      image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2
      container_name: elasticsearch3
      environment:
        - cluster.name=docker-cluster
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        - "discovery.zen.ping.unicast.hosts=elasticsearch"
        - http.cors.enabled=true
        - http.cors.allow-origin=*
        - discovery.zen.minimum_master_nodes=2
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata3:/usr/share/elasticsearch/data
      networks:
        - esnet
        - frontend
        - backend
  
    kibana:
      image: 'docker.elastic.co/kibana/kibana:6.4.2'
      container_name: kibana
      environment:
        SERVER_NAME: kibana.local
        ELASTICSEARCH_URL: http://elasticsearch:9200
      ports:
        - '5601:5601'
      networks:
        - esnet
        - frontend
        - backend
  
    headPlugin:
      image: 'mobz/elasticsearch-head:5'
      container_name: head
      ports:
        - '9100:9100'
      networks:
        - esnet
        - frontend
        - backend
  </code></pre>
  
  <p>Here is scout_elastic config</p>
  
  <pre><code>&lt;?php
  
  return [
      'client' =&gt; [
          'hosts' =&gt; [
              env('SCOUT_ELASTIC_HOST', 'localhost:9200'),
          ],
      ],
      'update_mapping' =&gt; env('SCOUT_ELASTIC_UPDATE_MAPPING', true),
      'indexer' =&gt; env('SCOUT_ELASTIC_INDEXER', 'single'),
      'document_refresh' =&gt; env('SCOUT_ELASTIC_DOCUMENT_REFRESH'),
  ];
  </code></pre>
  
  <p>And .env scout config</p>
  
  <pre><code>SCOUT_DRIVER=elastic
  </code></pre>