Skip to content

Instantly share code, notes, and snippets.

@evertonmatos
Forked from shavo007/docker-compose.yml
Created March 19, 2020 01:43
Show Gist options
  • Save evertonmatos/d098001bf1421c88624fb6d98d45cc99 to your computer and use it in GitHub Desktop.
Save evertonmatos/d098001bf1421c88624fb6d98d45cc99 to your computer and use it in GitHub Desktop.
Docker compose (mysql, elasticsearch, kibana) with healthchecks
version: '2.1'
services:
mysql:
container_name: mysql
image: mysql:5.7
ports:
- "13306:3306"
environment:
- MYSQL_ROOT_PASSWORD=Welcome123
healthcheck:
test: ["CMD-SHELL", "mysqladmin -h 'localhost' -u root -pWelcome123 ping --silent"]
interval: 30s
timeout: 30s
retries: 3
volumes:
- mysqldata:/var/lib/mysql
networks:
- dbnet
elasticsearch:
image: elasticsearch:5.3
container_name: elasticsearch
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 30s
retries: 3
environment:
- "ES_JAVA_OPTS=-Xmx2g -Xms2g"
- bootstrap.memory_local=true
- cluster.name=adlp-cluster
ports:
- 19200:9200
- 19300:9300
volumes:
- ./elasticsearch/config/elasticsearch.yml:/etc/elasticsearch/config/elasticsearch.yml
- ./elasticsearch/config/jvm.options:/etc/elasticsearch/config/jvm.options
- ./elasticsearch/config/log4j2.properties:/etc/elasticsearch/config/log4j2.properties
- esdata:/usr/share/elasticsearch/data
networks:
- esnet
kibana:
image: kibana:5.3
container_name: kibana
depends_on:
elasticsearch:
condition: service_healthy
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
- XPACK_MONITORING_ENABLED=false
depends_on:
- elasticsearch
networks:
- esnet
volumes:
mysqldata:
driver: local
esdata:
driver: local
networks:
esnet:
driver: bridge
dbnet:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment