首先需要单机运行
docker run --name elasticsearch -p 8100:8100 -p 8200:8200 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx1024m" -d elasticsearch:7.4.2
|
docker cp elasticsearch:/usr/share/elasticsearch/config /home/es/
|
docker stop elasticsearch
|
docker remove elasticsearch
|
docker run --name elasticsearch -p 8100:8100 -p 8200:8200 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx1024m" -v /home/es/config:/usr/share/elasticsearch/config -v /home/es/data:/usr/share/elasticsearch/data -v /home/es/plugins:/usr/share/elasticsearch/plugins --privileged=true -d elasticsearch:7.4.2
最后查看文件权限如果有权限就重启