Search Tutorials


Deploy Elasticsearch + Kibana as Docker Containers | JavaInUse

Deploy Elasticsearch + Kibana as Docker Containers

In previous Spring Boot + Docker Tutorials we have seen the basics of docker. In this tutorial we will be deploying elasticsearch and kibana as docker containers. Also in next tutorial we will be implementing Spring Boot Application to connect to Elasticsearch Docker Container using HTTPS.
Deploy Elasticsearch + Kibana as Docker Containers

Video

This tutorial is explained in the below Youtube Video.


Implementation

Elasticsearch

For this we will be taking reference of elasticsearch docker reference page.
Create a new docker network. In a previous Deploying Multiple Spring Boot Microservices to Docker using Docker Networking we have seen that for to docker containers to communicate with each other we need to create a dedicated network.
docker network create elastic

Elasticsearch Network
Pull the Elasticsearch Docker image.
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.14.3





Elasticsearch 8 Image
Start an Elasticsearch container.
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.14.3

Elasticsearch 8 Container
This will start elasticsearch in docker container. Also we have exposed the port externally at 9200.
Elasticsearch 8 Container
If we now go to https://localhost:9200 we can connect to the elasticsearch instance running in docker. We need to provide the username and password. Username is elastic and password will be the one shown in the console when we started the elasticsearch docker container above.
Elasticsearch 8 Docker Container

Elasticsearch 8 Docker Container

Kibana

Pull the Kibana Docker image.
docker pull docker.elastic.co/kibana/kibana:8.14.3

Kibana Docker image
Start a Kibana container.
docker run --name kib01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.14.3

Kibana Docker image Container
If we now copy the code as shown above - http://0.0.0.0:5601/?code=508343 and go to localhost:5601/?code=508343, we will need to provide the enrolment token, which is provided to use on elasticsearch docker startup.
Kibana docker startup
Next provide the same credentials we had used for elasticsearch.
Kibana docker credentials
Kibana is started as follows-
Kibana Container started