Install Elasticsearch & Kibana via Docker
It is sometimes helpful to have a local development Elasticsearch & Kibana setup.
The following instructions work on any macOS or Linux computer and this 2-container setup is created:
- Elasticsearch running on
localhost:9200
with Basic Auth credentialselastic
andsecret
- Kibana running on
localhost:5601
which is connected to Elasticsearch
IMPORTANT
The setup is not meant for production! Please consult the official Elasticsearch documentation for how to run Elasticsearch and Kibana on production.
1. Build Elasticsearch & Kibana Images
# download Elasticsearch & Kibana images docker pull docker.elastic.co/elasticsearch/elasticsearch-platinum:6.0.0 docker pull docker.elastic.co/kibana/kibana:6.0.0
2. Run Elasticsearch & Kibana Containers
The following listing creates two containers in daemon mode. They are automatically deleted / removed on stop via the parameter --rm
.
# run Basic Auth Elasticsearch(user: 'elastic', pw 'secret') daemon # in auto-remove mode, start takes 20+ seconds docker run -d --rm -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "transport.host=127.0.0.1" -e ELASTIC_PASSWORD=secret --name elastic docker.elastic.co/elasticsearch/elasticsearch-platinum:6.0.0 && sleep 20 # run Kibana daemon in auto-remove mode # start takes 20+ seconds docker run -d --rm --link elastic:elastic-url -e "ELASTICSEARCH_URL=http://elastic-url:9200" -e ELASTICSEARCH_PASSWORD="secret" -p 5601:5601 --name kibana docker.elastic.co/kibana/kibana:6.0.0 && sleep 20 # check connection to Elasticsearch (JSON is returned) curl "http://localhost:9200/_count" -u 'elastic:secret' # check connection to Kibana (HTML is returned) curl http://localhost:5601 --location
Kibana is now running on http://localhost:5601/ and you can log in with user "elastic" and password "secret".
1. Stop Elasticsearch & Kibana Containers
To stop and delete the containers enter these 2 lines:
docker stop elastic kibana