---
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.8
container_name: elasticsearch
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./data:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- es
kibana:
image: docker.elastic.co/kibana/kibana:7.17.8
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: '["http://elasticsearch:9200"]'
I18N_LOCALE: zh-CN
networks:
- es
depends_on:
- elasticsearch
privileged: true
ports:
- 5601:5601
networks:
es:
driver: bridge
这里需要注意的是:
elasticsearch 所映射出来的文件夹./data 的权限一定要是777,否则,无法正常启动。