(1).下载镜像,最好走代理,就算换阿里云镜像还是走官网镜像拉取
代码语言:javascript复制 docker pull docker.elastic.co/elasticsearch/elasticsearch:6.5.1
(2).运行镜像,生成容器id:8360130bde68
代码语言:javascript复制docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.5.1
(3).进入容器bash,想自己修改配置可以改,我改下允许跨域
代码语言:javascript复制docker exec -it 8360130bde68 /bin/bash
cd config
vi elasticsearch.yml
##增加的配置
http.cors.enabled: true
http.cors.allow-origin: "*"
(4).修改完重启容器.
代码语言:javascript复制docker restart 8360130bde68
(5).安装head插件
代码语言:javascript复制docker pull mobz/elasticsearch-head:5
docker run -d --name es_head -p 9100:9100 mobz/elasticsearch-head:5