title: Running elasticsearch in docker
body: <p>I'm trying to run elasticsearch in a Docker container on my laptop (Mac OS) and running my tests connecting on the TCP port 9300.</p>
  
  <p>First I tried to run it without docker:</p>
  
  <pre><code>wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
  unzip elasticsearch-5.1.1.zip
  cd elasticsearch-5.1.1
  
  echo "cluster.name: test
  client.transport.sniff: false
  discovery.zen.minimum_master_nodes: 1
  
  network.host:
  - _local_
  - _site_
  
  network.publish_host: _local_" &gt; config/elasticsearch.yml
  
  ./bin/elasticsearch
  </code></pre>
  
  <p>All works well.</p>
  
  <p>Now if I try in docker:</p>
  
  <pre><code>docker run -p 9300:9300 -ti openjdk
  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
  unzip elasticsearch-5.1.1.zip
  cd elasticsearch-5.1.1
  
  echo "cluster.name: test
  client.transport.sniff: false
  discovery.zen.minimum_master_nodes: 1
  
  network.host:
  - _local_
  - _site_
  
  network.publish_host: _local_" &gt; config/elasticsearch.yml
  
  chmod 777 -R .
  useradd elastic
  su elastic
  ./bin/elasticsearch
  </code></pre>
  
  <p>It would work for the first suite of tests but not the second one where it throws:</p>
  
  <pre><code>org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes were available: [{nlR3i79}{nlR3i797RuKXJqS86GExXQ}{O6ltC6a5R-asNMuvCt3c4w}{127.0.0.1}{127.0.0.1:9300}]
  </code></pre>
  
  <p>Cheers</p>