1. 拉取景象
docker search elasticsearch
2. 选取第一个
docker pull elasticsearch
3. 拉取速度太慢,更好国内镜像
{"registry-mirrors":["https://reg-mirror.qiniu.com/"]}
4. 启动镜像
docker run -d --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" elasticsearch:latest
5. docker 拉取elasticsearch-head
docker pull mobz/elasticsearch-head
6. elasticsearch-head无法连接,进入docker elasticsearch解决跨域问题
cd ./config
echo "
http.cors.enabled: true
http.cors.allow-origin: '*' " >> elasticsearch.yml
7. 重启elasticsearch
docker restart [elasticsearch ID]
网友评论