参考 官网文档
常见问题
1、提示内存不足
2、提示目录不存在
在配置文件中注意修改相关参数即可
version: '2'
services:
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 // 注意修改为自己所下载的版本
ports:
- "9200:9200"
volumes:
- /elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /elasticsearch/data:/usr/share/elasticsearch/data // 注意修改为自己对应的目录
- /elasticsearch/plugins:/usr/share/elasticsearch/plugins
environment:
- "ES_JAVA_OPTS=-Xms64m -Xmx512m" // 内存大小
- "discovery.type=single-node"
- "COMPOSE_PROJECT_NAME=elasticsearch-server"
restart: always
elasticsearch.client 文档