Install Elasticsearch & Kibana via Docker

It is sometimes helpful to have a local development  ElasticsearchKibana setup. 

The following instructions work on any macOS or Linux computer and this 2-container setup is created:

  1. Elasticsearch running on localhost:9200 with Basic Auth credentials elastic and secret
  2. Kibana running on  localhost:5601  which is connected to Elasticsearch

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 pull

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 "" -e ELASTIC_PASSWORD=secret --name elastic && 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 && 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

Still need help? Contact Us Contact Us