1. 下载镜像
docker pull elasticsearch:6.8.0
2. 创建network
docker network create dnw_es_680
3. 创建容器
docker run -d --name es_680 --net dnw_es_680 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.8.0
4. 查看ES状态
http://192.168.99.100:9200/
5. 安装elasticsearch-head
docker pull mobz/elasticsearch-head:5
docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5
6. 修改es配置,支持跨域访问
docker exec -it es_680 /bin/bash
vi config/elasticsearch.yml
添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
重启容器:
docker restart es_680
7. 访问elasticsearch-head
http://192.168.99.100:9100/