一、创建网络
docker network create es-net
二、拉取镜像
docker pull elasticsearch:8.6.0
三、创建容器
docker run -d \ --name elasticsearch \ --network es-net \ -p 9200:9200 \ -p 9300:9300 \ --privileged \ elasticsearch:8.6.0
四、修改配置elasticsearch.yml
讲容器内的配置文件复制到本机
docker cp 容器ID:/usr/share/elasticsearch/config/elasticsearch.yml /Users/yf/Downloads/elasticsearch.yml
关闭密码验证,修改elasticsearch.yml
xpack.security.enabled: false
把配置文件上传到容器内
docker cp /Users/yf/Downloads/elasticsearch.yml 容器ID:/usr/share/elasticsearch/config/elasticsearch.yml
五、重启容器
docker restart elasticsearch
六、访问测试是否成功
http://127.0.0.1:9200/
标签:容器,9200,--,Elasticsearch,elasticsearch,docker,安装,yml From: https://www.cnblogs.com/fyiyy/p/18362719