1.下载镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.2
2.快速运行docker
docker run -d --name myElasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2
3.基础配置
docker exec -it myElasticsearch /bin/sh
# 修改配置文件
vi elasticsearch.yml
# 加入跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"