liunx配置文件
vim /etc/sysctl.conf
vm.max_map_count = 262144
sysctl -p
拉取ES8.4.3镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.4.3
创建elastic内部网络
docker network create elastic
docker启动ES
docker run --name elasticsearch --net elastic -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 -v /home/data/elasticsearch/data:/usr/share/elasticsearch/data -v /home/data/elasticsearch/logs:/usr/share/elasticsearch/logs -it docker.elastic.co/elasticsearch/elasticsearch:8.4.3
进入内部查看配置文件位置
docker exec -it elasticsearch /bin/bash
把容器里的文件copy出来
docker cp elasticsearch:/usr/share/elasticsearch/config/elasticsearch.yml .
修改elasticsearch.yml
把修改好的配置文件copy容器里
docker cp elasticsearch.yml elasticsearch:/usr/share/elasticsearch/config/elasticsearch.yml
重启容器
docker restart elasticsearch
启动现有容器
docker start elasticsearch