You are currently viewing How to Install Kibana Using Docker

How to Install Kibana Using Docker

1. Introduction

Kibana is an open-source data visualization and exploration tool designed to work with Elasticsearch. Kibana is part of the ELK Stack (Elasticsearch, Logstash, Kibana). In this tutorial, you will learn how to install Kibana using Docker. You will also learn how to configure Kibana to visualize data from Elasticsearch.

2. Prerequisites

  • You are expected to have basic knowledge of Docker. This tutorial uses Docker Desktop for Windows, but you can use any other Docker installation depending on your Operating System. Moving forward, we will assume that you have a working installation of Docker in your workstation.
  • This tutorial also assumes that you have Elasticsearch working in your local environment. Follow this tutorial if this is not the case for you.

3. Create the Network

This step is important because Kibana will be communicating with Elasticsearch, so they must share the same network.

Important: Skip this step if you have already followed this other tutorial dedicated to Elasticsearch.

Issue the command below to create a network interface named “elk”:

docker network create elk

Your output will be similar to this:

759d536b180c54486af7414d1f9f7017f9df405ef41c991db5e3f011c20cd5ab

4. Pull the Kibana Docker image

You can find the Docker images for Kibana in the Docker Elastic Registry. For this tutorial, we will be installing the version 8.14.3.
Open a command prompt (or a terminal) and run the following command:

>docker pull docker.elastic.co/kibana/kibana:8.14.3

After some time, you’ll see an output similar to this:
kibana-image-pull.png

5. Create Kibana Configuration files

Kibana requires a configuration file in YAML format. We will create a kibana.yml file under “C:\apps\kibana\config”, with the following content:

# Kibana configuration file
server.name: kibana
server.host: "0.0.0.0"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]

Pay attention to the way Elasticsearch host is specified. We use the name “elasticsearch” instead of “localhost” because Elasticsearch and Kibana are running in Docker containers.

Here is the structure of our kibana directory in Windows:

Folder PATH listing for volume Windows
Volume serial number is XXXXXX
C:\APPS\KIBANA
└───config
        kibana.yml

6. Start the Container

Once the image is pulled and the configuration file is created, use the following command to start the Kibana container:

>docker run --name kibana -h kibana --net elk -it -m 1GB -v C:/apps/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml docker.elastic.co/kibana/kibana:8.14.3
  • --name kibana is the name we are giving to the container
  • --h kibana is the hostname of the docker container
  • --net elk : to specify the network to which the container is attached
  • -m 1GB : to limit the memory size
  • -v ... : to bind a directory in the host machine to a directory in the container. This is used when we want the data to be persistent if the container is restarted.

If everything goes well, you will have the following output:

kibana-image-run.png

As you can see, Kibana has started, and you can access it using your web browser at http://127.0.0.1:5601/

7. Install Kibana: Verifications

Navigate to http://127.0.0.1:5601/?code=503773 using your web browser. You will be redirected to the following screen:

kibana-start-token.png

Generate an enrollment token with Elasticsearch
If you already have an enrollment token, you can use it. Else, use the following command to regenerate a new token:

>docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

Note that “es01” is the name of our Elasticsearch container. After running the above command, you will receive an output like this:

kibana-enrollment-token.png

Copy and paste the token in the Kibana configuration windows in your web browser.

kibana-start-token-2.png

After hitting “configure”, Kibana will send a verification code to the console:

kibana-verif-code.png

Type the verification code in the dedicated field as shown here:

kibana-verif-required.png

If everything is ok, Kibana will start its configuration, and you will see a screen similar to this:

kibana-verif-ok.png

Kibana will redirect you to the login screen once the setup is complete:

kibana-login.png

You can then log in with the credentials you got while installing Elasticsearch(the credentials of the Elasticsearch backend). After a successful login, the Kibana home screen appears:

kibana-home.png

8. Conclusion

In this tutorial, you learned how to run Kibana using Docker. In the next tutorial, you will learn how to configure Kibana to visualize the content of Elasticsearch indices.

Noel Kamphoa

Experienced software engineer with expertise in Telecom, Payroll, and Banking. Now Senior Software Engineer at Societe Generale Paris.

This Post Has 3 Comments

Comments are closed.