拉取镜像
docker pull elasticsearch:7.8.0
docker pull kibana:7.8.0
docker pull mobz/elasticsearch-head:5
创建目录
mkdir -p /opt/module/elasticsearch/config
mkdir -p /opt/module/elasticsearch/data
mkdir -p /opt/module/elasticsearch/logs
mkdir -p /opt/module/elasticsearch/plugins
添加yml文件
http.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
启动容器
docker stop elasticsearch && docker rm elasticsearch
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 --restart=always --privileged=true \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms84m -Xmx512m" \
-v /opt/module/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /opt/module/elasticsearch/data:/usr/share/elasticsearch/data \
-v /opt/module/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.8.0
docker stop es-head && docker rm es-head
echo "starting es-head"
docker run -d --name es-head -p 9100:9100 --restart=always --privileged=true docker.io/mobz/elasticsearch-head:5
echo "starting kibana"
docker stop kibana && docker rm kibana
docker run --name kibana --restart=always --privileged=true \
-e ELASTICSEARCH_URL=http://192.168.11.10:9200 \
--link=elasticsearch:elasticsearch \
-p 5601:5601 \
-d kibana:7.8.0
docker ps -a