bash
# 拉取镜像
docker pull elasticsearch:7.14.0
# 运行 ---
# 拷贝数据用于挂载
docker cp -a es:/usr/share/elasticsearch/config/. /volume/es/config
# 启动容器
docker run -p 9200:9200 -p 9300:9300 --privileged=true --name es -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -v /volume/es/config:/usr/share/elasticsearch/config -d elasticsearch:7.14.0
# 拉取es-head镜像
docker pull mobz/elasticsearch-head:5
# 运行
docker run --name es-head -d -p 9100:9100 mobz/elasticsearch-head:5
eshead配置需要es开启跨域
在/usr/share/elasticsearch/config/的elasticsearch.yml下
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type