1.拉取elasticsearch-head
docker pull mobz/elasticsearch-head:5
2.启动elasticsearch-head
docker run --privileged=true --restart=always --net=randeng_network --ip 192.168.1.61 --name elasticsearch --name=elasticsearch-head -p 9100:9100 -d mobz/elasticsearch-head:5
--net=randeng_network --ip 192.168.1.61
--restart=always
--privileged=true
3.把elasticsearch加入到network中
不加入的话,elasticsearch-head容器无法访问外部网络
docker network connect bridge elasticsearch-head
4.在浏览器中打开elasticsearch-head
http://localhost:9200/
5.下面是使用过程中遇到的一些坑
5.1 Docker安装ElasticSearch-Head完毕后,创建索引报错406
报错内容为"Content-Type header [application/x-www-form-urlencoded] is not supported"
解决方法:
docker exec -it elasticsearch-head /bin/bash
apt-get update
apt-get install vim
vim _site/vendor.js
contentType: "application/x-www-form-urlencoded
改成
contentType: "application/json;charset=UTF-8"
# 第一处 7574行
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
改成
var inspectData = s.contentType === "application/json;charset=UTF-8" &&
exit
docker restart elasticsearch-head
|