Joan
Joan

Reputation: 4300

Running elasticsearch in docker

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.

First I tried to run it without docker:

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_" > config/elasticsearch.yml

./bin/elasticsearch

All works well.

Now if I try in docker:

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_" > config/elasticsearch.yml

chmod 777 -R .
useradd elastic
su elastic
./bin/elasticsearch

It would work for the first suite of tests but not the second one where it throws:

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}]

Cheers

Upvotes: 1

Views: 10523

Answers (1)

Jack
Jack

Reputation: 882

Take a look here:

Here an example:

docker run -d elasticsearch:5.1.1

Upvotes: 5

Related Questions