docker run -it -d -p 9000-9900:9000-9900 --name cenosElasticsearch centos
docker run -it -d -p 9200:9200 -p 9300:9300 --name cenosElasticsearch3 e11524101e04
docker ps
docker attach e584c6fb2eff
这里启动容器选择了一段ip和主机ip映射「-p 9000-9900:9000-9900」可以使用docker port 命令查看具体映射
docker port e584c6fb2eff
yum install java -y
yum install wget -y
yum install vim -y
yum install net-tools -y
这里我们下载文件到/usr/local/
cd /usr/local/ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.1.tar.gz
tar -zxvf elasticsearch-6.3.1.tar.gz
vi config/elasticsearch.yml
找到network.host这一项,并且改为network.host: 0.0.0.0,这里修改其实就是为了宿主机能够直接访问。
passwd
groupadd es
useradd es -g es -p es
passwd es
chown -R es:es elasticsearch-6.3.1
su es
bin/elasticsearch -d
tail logs/elasticsearch.log
容器访问
curl http://127.0.0.1:9200/
http://127.0.0.1:9200/
docker pull registry.cn-hangzhou.aliyuncs.com/m65536/centos-elastic
Docker官方Centos镜像下安装Elasticsearch【详细步骤】
原文:http://blog.51cto.com/13828850/2147118