I am running a docker in my ubuntu host with the following:
docker run -d --rm -p 9200:9200 -p 9300:9300 --name elasticsearch6.6.1 docker.elastic.co/elasticsearch/elasticsearch:6.6.1
Later on when I query like so, I get failure:
curl 'http://localhost:9200/?pretty'
The failure looks like so:
curl ' http://localhost:9200/?pretty '
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/dcac22e9-6b6f-443b-8497-c093dd6bb804.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (56) Recv failure: Connection reset by peer
So, my question is:
How do I start elasticsearch on docker and publish the ports 9200 and 9300 to the host?
Is network.host=_ site _ setting required?
Thanks,
After reviewing the image that you have mentioned, please check the logs of the container as you might have an error similar to this:
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
In my case solved by: sysctl -w vm.max_map_count=262144
then when i try the curl
command it works as expected:
curl 'http://localhost:9200/?pretty'
{
"name" : "WgMEnP1",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "2USHCgsWTQOWK5g76uOnNQ",
"version" : {
"number" : "6.6.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1fd8f69",
"build_date" : "2019-02-13T17:10:04.160291Z",
"build_snapshot" : false,
"lucene_version" : "7.6.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
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.