创建环境变量文件
在docker-compose.yml所在目录下创建.env,并键入以下内容
ELK_VERSION=7.14.2
docker-compose.yml
version: "3"
services:
elasticsearch:
image: elasticsearch:${ELK_VERSION}
container_name: elasticsearch-${ELK_VERSION}
environment:
- TZ=Asia/Shanghai
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- 9200:9200
- 127.0.0.1:9300:9300
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
# - ./elasticsearch/config/:/usr/share/elasticsearch/config/
- ./elasticsearch/data/:/usr/share/elasticsearch/data/
- ./elasticsearch/logs/:/usr/share/elasticsearch/logs/
- ./elasticsearch/plugins:/usr/share/elasticsearch/plugins
networks:
- elk-net
kibana:
image: kibana:${ELK_VERSION}
container_name: kibana-${ELK_VERSION}
depends_on:
- elasticsearch
ports:
- "5601:5601"
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
- ./kibana/config/:/usr/share/kibana/config/
networks:
- elk-net
networks:
elk-net:
driver: bridge