Install and Configure Elasticsearch, Logstash, Kibana on Docker

Install and Configure Elasticsearch, Logstash, Kibana on Docker

This tutorial how to install ELK stack on Docker Containers

Install Docker on Debian-Based Distributions

apt update
apt install apt-transport-https ca-certificates curl software-properties-common -y
echo 'deb [arch=amd64] bionic stable' >> /etc/apt/sources.list.d/docker.list
curl -fsSL | sudo apt-key add -

apt update
apt install docker-ce -y
curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Pull Elasticstack Image & Prepare

git clone /user/share/elastic
sysctl -w vm.max_map_count=262144

Set the PWD Environment Variable

echo 'PWD=/usr/share/elastic/' >> /usr/share/elastic/.env

Create Elasticstack containers

docker-compose -f .\setup.yml up

Save the password given at the end

NOTE: The password will only be given this once

Run the containers

docker-compose up -d

Access Kibana/Elastic

infconfig eth0

http://<IP Address>:5601 for Kibana (with your eth0 IP address)

  • Username: kibana
  • Password: Given earlier

http://<IP Address>:5601 for Elastic (with your eth0 IP address)

  • Username: elastic
  • Password: Given earlier

Enable HTTPS

Configure the values in the config files


# Auditbeat

# Filebeat

# Heartbeat

# Metricbeat

# Packetbeat
host: "https://localhost:5601"
protocol: "https"
ssl.enabled: true

Configure the values in /user/share/elastic/config/kibana/kibana.yml

server.ssl.enabled: true
server.ssl.certificate: /usr/share/kibana/config/certs/kibana/kibana.crt
server.ssl.key: /usr/share/kibana/config/certs/kibana/kibana.key

Then restart the stack

docker-compose restart
  • You can then monitor status via docker container ls

NOTE: It can takes a minute or so after containers are "healthy", and more time for Kibana to successfully connect to the elasticsearch service


  • Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
  • Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.
  • Logstash is a free and open server-side data processing pipeline that ingests data from a multitude of sources, transforms it, and then sends it to your favorite "stash."
  • Kibana is a data visualization dashboard for Elasticsearch. It provides visualization capabilities on top of the content indexed on an Elasticsearch cluster. Users can create bar, line and scatter plots, or pie charts and maps on top of large volumes of data.