Skip to content

Instantly share code, notes, and snippets.

@mirzap
Forked from wshayes/Dockerfile-es
Created July 12, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirzap/009a788c93718fa0767b162c5c8f9b97 to your computer and use it in GitHub Desktop.
Save mirzap/009a788c93718fa0767b162c5c8f9b97 to your computer and use it in GitHub Desktop.
Elasticsearch and Kibana using docker-compose (v3)
# docker-compose build && docker-compose up -d
version: "3.2"
volumes:
elasticsearch_data:
driver: local
kibana_data:
driver: local
services:
# Access api endpoint at http://localhost:9200
elasticsearch:
container_name: elasticsearch
image: elasticsearch
build:
context: .
dockerfile: Dockerfile-es
ports:
- "9200:9200"
expose: # exposed by the dockerfile
- "9200"
- "9300"
volumes:
- ce-esdata:/usr/share/elasticsearch/data
- ./elasticsearch.yml:/conf/elasticsearch.yml
# logging:
# driver: none
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
restart: always
# Access api endpoint at http://localhost:9200
# With XPack plugin
# elasticsearch:
# container_name: elasticsearch
# image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1
# ports:
# - "9200:9200"
# volumes:
# - elasticsearch_data:/usr/share/elasticsearch/data
# - ./elasticsearch.yml:/conf/elasticsearch.yml
# # logging:
# # driver: none
# environment:
# - cluster.name=docker-cluster
# - bootstrap.memory_lock=true
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# - xpack.security.enabled=false
# - xpack.watcher.enabled=false
# - xpack.monitoring.enabled=false
# - xpack.ml.enabled=false
# - xpack.graph.enabled=false
# ulimits:
# memlock:
# soft: -1
# hard: -1
# # deploy:
# # resources:
# # limits:
# # memory: 1g
# restart: always
# Access Kibana at http://localhost:5601 without Traefik
# Access Kibana at http://kibana.test (if using Traefik)
kibana:
container_name: kibana
image: docker.elastic.co/kibana/kibana:5.5.1 # must match elasticsearch image
ports:
- 5611:5601
volumes:
- kibana_data:/usr/share/kibana/data
labels: # used for Traefik dynamic configuration
- traefik.enable=true
- traefik.backend=kibana
- traefik.frontend.rule=Host:kibana.test
- traefik.port=5601
depends_on:
- elasticsearch
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
- xpack.security.enabled=false
# logging:
# driver: none
restart: always
# Reverse proxy for BEL API and other web endpoints
# Access mgmt interface at http://localhost:8088
# have to add kibana.test to /etc/hosts or /windows/system32/drivers/etc/hosts
traefik:
image: traefik:latest
container_name: traefik
ports:
- "80:80"
- "443:443"
- "8088:8088"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/traefik.toml
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1
RUN \
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack
http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length
defaultEntryPoints = ["http"]
# logLevel = "DEBUG"
[web]
address = ":8088"
[web.statistics]
[entryPoints]
[entryPoints.http]
address = ":80"
################################################################
# Docker configuration backend
################################################################
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "docker.localhost"
watch = true
# Expose containers by default in traefik
exposedbydefault = false
# Use Swarm Mode services as data provider
swarmmode = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment