-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathdocker-compose-elk.yml
68 lines (64 loc) · 2.76 KB
/
docker-compose-elk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
version: '3'
# 网桥elk -> 方便相互通讯
networks:
elk:
services:
elasticsearch:
image: registry.cn-hangzhou.aliyuncs.com/zhengqing/elasticsearch:7.14.1 # 原镜像`elasticsearch:7.14.1`
container_name: elk_elasticsearch # 容器名为'elk_elasticsearch'
restart: unless-stopped # 指定容器退出后的重启策略为始终重启,但是不考虑在Docker守护进程启动时就已经停止了的容器
volumes: # 数据卷挂载路径设置,将本机目录映射到容器目录
- "./elk/elasticsearch/data:/usr/share/elasticsearch/data"
- "./elk/elasticsearch/logs:/usr/share/elasticsearch/logs"
- "./elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml"
# - "./elk/elasticsearch/config/jvm.options:/usr/share/elasticsearch/config/jvm.options"
environment: # 设置环境变量,相当于docker run命令中的-e
TZ: Asia/Shanghai
LANG: en_US.UTF-8
TAKE_FILE_OWNERSHIP: "true" # 权限
discovery.type: single-node
ES_JAVA_OPTS: "-Xmx512m -Xms512m"
ELASTIC_PASSWORD: "123456" # elastic账号密码
ports:
- "9200:9200"
- "9300:9300"
networks:
- elk
kibana:
image: registry.cn-hangzhou.aliyuncs.com/zhengqing/kibana:7.14.1 # 原镜像`kibana:7.14.1`
container_name: elk_kibana
restart: unless-stopped
volumes:
- "./elk/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml"
ports:
- "5601:5601"
depends_on:
- elasticsearch
links:
- elasticsearch
networks:
- elk
logstash:
image: registry.cn-hangzhou.aliyuncs.com/zhengqing/logstash:7.14.1 # 原镜像`logstash:7.14.1`
container_name: elk_logstash
restart: unless-stopped
environment:
LS_JAVA_OPTS: "-Xmx512m -Xms512m"
volumes:
- "./elk/logstash/data:/usr/share/logstash/data"
- "./elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml"
# - "./elk/logstash/config/logstash.conf:/usr/share/logstash/config/logstash.conf"
- "./elk/logstash/config/small-tools:/usr/share/logstash/config/small-tools"
# command: logstash -f /usr/share/logstash/config/logstash.conf # 指定logstash启动时使用的配置文件 - 指定单个文件
command: logstash -f /usr/share/logstash/config/small-tools # 指定logstash启动时使用的配置文件 - 指定目录夹(系统会自动读取文件夹下所有配置文件,并在内存中整合)
ports:
- "9600:9600"
# - "10001-10010:10001-10010"
- "1218:1218"
- "20010:20010"
- "20030:20030"
- "20040:20040"
depends_on:
- elasticsearch
networks:
- elk