1version: '3'
2
3services:
4 create_certs:
5 container_name: create_certs
6 image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
7 command: >
8 bash -c '
9 if [[ ! -f ./config/certificates/elastic-certificates.p12 ]]; then
10 bin/elasticsearch-certutil cert -out config/certificates/elastic-certificates.p12 -pass ""
11 fi;
12 chown -R 1000:0 /usr/share/elasticsearch/config/certificates
13 '
14 user: "0"
15 working_dir: /usr/share/elasticsearch
16 volumes: ['certs:/usr/share/elasticsearch/config/certificates']
17
18 elasticsearch:
19 container_name: elasticsearch
20 depends_on: [create_certs]
21 image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
22 environment:
23 - cluster.name=docker-cluster
24 - bootstrap.memory_lock=true
25 - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
26 - ELASTIC_PASSWORD=MyPassword # password for default user: elastic
27 - xpack.security.enabled=true
28 - xpack.security.transport.ssl.enabled=true
29 - xpack.security.transport.ssl.verification_mode=certificate
30 - xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12
31 - xpack.security.transport.ssl.truststore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12
32 volumes: ['esdata:/usr/share/elasticsearch/data', 'certs:/usr/share/elasticsearch/config/certificates']
33 ulimits:
34 nofile:
35 soft: 65536
36 hard: 65536
37 memlock:
38 soft: -1
39 hard: -1
40 ports:
41 - "9200:9200"
42
43 kibana:
44 container_name: kibana
45 depends_on: [elasticsearch]
46 image: docker.elastic.co/kibana/kibana:7.9.3
47 environment:
48 - ELASTICSEARCH_USERNAME=elastic
49 - ELASTICSEARCH_PASSWORD=MyPassword
50 ports:
51 - "5601:5601"
52
53volumes: {"esdata", "certs"}
54