Skip to content

Instantly share code, notes, and snippets.

@kallebysantos
Last active May 9, 2023 13:19
Show Gist options
  • Save kallebysantos/624cd54fccff8bba5964df53a68655b0 to your computer and use it in GitHub Desktop.
Save kallebysantos/624cd54fccff8bba5964df53a68655b0 to your computer and use it in GitHub Desktop.
Elastic Stack with Docker

Elastic Stack with Docker - GUIDE

Starting docker containers:

In order to start the Elastic + Kibana containers you should execute the following command:

docker compose up -d

Setting up Elasticsearch:

Once the container service has started run the following command to regenerate an user password:

docker compose exec -it elasticsearch /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

Setting up Kibana:

On Kibana browser page it will ask for the Enrollment token. I order to generate it run the following command:

docker compose exec -it elasticsearch /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

Then paste the genereated token in the textbox

Login to Elastic:

Enter the following credentials:

  • User: elastic
  • Password: the secret password generated before
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.7.1
container_name: elasticsearch
environment:
- license=basic
- node.name=es-node
- cluster.name=es-cluster
- discovery.type=single-node
ports:
- 9200:9200
- 9300:9300
volumes:
- local-es:/usr/share/elasticsearch/data
networks:
- es-net
logstash:
image: docker.elastic.co/logstash/logstash:8.7.1
container_name: logstash
volumes:
# - ./logstash/logstash.config.yml:/usr/share/logstash/config/logstash.yml
# - ./logstash/pipeline/:/usr/share/logstash/pipeline:ro
ports:
- 8080:8080
- 5000:5000
- 9600:9600
networks:
- es-net
depends_on:
- elasticsearch
kibana:
image: docker.elastic.co/kibana/kibana:8.7.1
container_name: kibana
environment:
- "ELASTICSEARCH_URL=http://elasticsearch:9200"
ports:
- 5601:5601
networks:
- es-net
depends_on:
- elasticsearch
restart: "unless-stopped"
networks:
es-net:
volumes:
local-es:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment