Alpha Coder

Here’s a quick Elasticsearch-Kibana setup via Docker for development

Are you new to the Elastic stack or configuring a new machine and need an easy way to setup, and a single command to run Elasticsearch & Kibana? Here’s a quick Elasticsearch-Kibana setup using Docker for your dev environment.

Setup

Run

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
docker container stop es_dev && docker container rm es_dev
docker run \
    --name es_dev \
    -p 9200:9200 \
    -p 9300:9300 \
    -e "discovery.type=single-node" \
    docker.elastic.co/elasticsearch/elasticsearch:7.3.0 &\

docker run \
    --link es_dev:elasticsearch \
    -p 5601:5601 \
    docker.elastic.co/kibana/kibana:7.3.0 &

The first command stops the container named es_dev (arbitrary) if one exists and removes it. The second command starts a single-node Elasticsearch cluster inside a docker container named es_dev, and exposes it on ports 9200 and 9300. The third and last command starts Kibana on port 5601 and links it to the container (es_dev) where the Elasticsearch cluster is running. The last two commands are run concurrently.

You can add these three commands to a shell file (e.g elastic.sh) in order to run a single command to start Elasticsearch and Kibana i.e chmod +x elastic.sh && ./elastic.sh the first time and ./elastic.sh subsequently.

Test

Configure

Elasticsearch and Kibana can be configured using YAML. You can create config files and point to them when starting the containers.

Need help getting something to work in your project? Try Alpha Coder Support!

Subscribe to the Alpha Coder Newsletter!

Get timely updates on new articles, courses and more from Nicholas Kajoh. Unsubscribe anytime.

Enjoy the content on Alpha Coder? Please buy me a coffee. 😊

Previous post: I built a video-based vehicle counting system — here's how

Next post: How to connect to a host's database from inside a Docker container


comments powered by Disqus