In this blog, we will demonstrate the method to set up and configure Kibana with Elasticsearch on Docker.
How to Setup and Configure Kibana With Elasticsearch on Docker for Local Development?
Kibana is a free, open-source, and well-liked visualization tool. It is used to search and analyze Elasticsearch indexes, log analysis, and time series data through visualization tools such as heat maps, pie charts, histograms, and line graphs.
While managing platform-dependent application data in Elasticsearch, users may want to use virtual machines or Docker containers. The Docker containers are an easy way to use Kibana and Elastic search in an isolated virtual environment.
In order to set up and configure Kibana with Elasticsearch on Docker, go through the following steps.
Step 1: Setup and Start Docker
To download Docker on Windows, navigate to its official website and hit the “Download Docker Desktop” button:
Note: For the proper guideline on how to install and setup Docker on Windows, follow over linked post:
Step 2: Create a Network
To create a network that will be used to save Elasticsearch data, utilize the “docker network create <network-name>” command:
Note: Creating and embedding a network is not necessary. But it can be used for backup purposes as when the Docker container is removed, it will delete all the essential files and data. To save the data even after the container removal, users can use the created network.
Step 3: Pull the Elasticsearch Image
Next, pull the official Elasticsearch image from Docker official registry through the “docker pull” command:
Step 4: Run Elasticsearch
In to run the Elasticsearch inside the container, utilize the below command:
In the above command:
- “–name” is specifying the Elasticsearch container name.
- “–net” is used to embed the external network that is created in the above step.
- “-p” option is defining the container’s ports.
- “-t” is used to assign the “TTY-pseudo” terminal to the container:
If the image executes error-free, it will generate the default login credentials such as an “elastic” user and a password. Using these credentials, the user can access Elasticsearch. This will also generate the token as highlighted below. This will be used to configure Kibana with Elasticsearch:
Step 5: Pull Kibana Image
To install and setup Kibana in Docker, pull the Kibana official image from the Docker registry using the given command:
Step 6: Run Kibana
Now, run the Kibana image to create and start executing the Kibana container. By default, Kibana executes on the “5601” port. Therefore, we have used the “-p” option to specify and run the Kibana on the default port:
Step 7: Generate Kibana Configuration Token Using Elasticsearch Container
To configure the Kibana with Elasticsearch, the user needs to have the Kibana configuration token that was generated during the execution of Elasticsearch in Step 4. If this token is misplaced, users can regenerate it by using the below command:
The above command executes the Elasticsearch token generator command within the Elasticsearch container using the “docker exec” command:
Now, this token can be used to configure the Kibana with Elasticsearch.
Step 8: Configure Kibana With Elasticsearch
Now, to check whether the Kibana is running on the specified port and to configure it with Elasticsearch, navigate to the “localhost:5601” port. Next, to configure the Kibana, paste the above-generated token in the “Enrollment token” field. After that, hit the “Configure Elastic” button:
Upon doing so, Kibana will ask for a verification code that can be found from the terminal console where the user executed the Kibana image to start the container in Step 6:
Here is the verification code to configure Kibana with Elasticsearch. Enter this code on the “Verification required” screen and hit the “Verify” button:
As a result, the Kibana will be configured with Elasticsearch. Now, user can use Elasticsearch with Kibana UI interface:
That’s all about setting up and configuring Kibana with Elasticsearch.
Conclusion
To setup and configure Kibana with Elasticsearch in Docker, first, run the Elasticsearch container by pulling and executing the Elasticsearch official image from Docker registry. After that, pull the official Kibana image and execute it using the “docker run” command. Now, navigate to the “localhost:5601” URL and add the enrollment token that is generated when the Elasticsearch image is executed and hit the “Configure Elastic” button. This article has demonstrated the method to setup and configure the Kibana with Elasticsearch on Docker.