简体   繁体   中英

Docker running ubuntu with elasticsearch

I have a ubuntu docker. I install elasticsearch service it.

When i use the command "curl -X GET 'localhost:9200' ", it return me the version, the name, all right.

It means the elasticsearch is configured correct, but when i access on my browser out of docker , doesn't work.

I have already configured the network on elasticsearch.yml file in path: /etc/elasticsearch/elasticsearch.yml

I don't know the reason. When i start the docker i use the command:

docker run -it -p 9200:9200 ubuntu/elastic

Extra information : the elasticsearch is in ubuntu that it's a docker too. i start the ubuntu, and after that inside the ubuntu's container i start the elasticsearch service.

You should use the official ELS docker image instead and use the command in the documentation.

From ELS documentation :

The Docker image can be retrieved with the following command:

 docker pull docker.elastic.co/elasticsearch/elasticsearch:5.4.1 

[...]

Running Elasticsearch from the command lineedit

Development modeedit

Elasticsearch can be quickly started for development or testing use with the following command:

 docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" 

docker.elastic.co/elasticsearch/elasticsearch:5.4.1

By default elasticsearch is listening at 127.0.0.1 so it won't accessible outside the container. In order to be accessible outside container you will have to launch it using:

docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.4.1

This will make elasticsearch available on all IP addresses 0.0.0.0 then you will be able to access it. Detail can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM