30
How to run image Elasticsearch Container on Ubuntu 18.04
Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. To read more about at Elasticsearch Document.
In this post I will introduction setup about Elasticsearch container on Ubuntu 18.04. It is make sure you already install docker please check more content at Install Docker.
There are have 3 steps:
Step 1: Downloading image Elasticsearch
Pull Image Elasticsearch on Docker Hub by command:
docker pull elasticsearch:tag
Tag is a specific version image. Recommended specific for version if image have any change version in the future
Verify pull image success by command:
docker images
Step 2: Running in Development Mode for start container
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:tag
Some describes:
- -d: It is detach running container in background
- --name: The name of container
- -p: Port container will expose to host
- -e: It is environment for container
Verify running container success
The command just shows running containers
docker ps
To see all containers, use flag -a
docker ps -a
Open browser access localhost:9200
Step 3: Stop running container and remove container
You can stop container by id or by name
docker stop container_id
docker stop container_name
Verify stop container by command
docker ps -a
docker ps
In this post I have implemented setup Elasticsearch by pull image, run, stop and remove container on Ubuntu 18.04. To learn more about Docker Document, and Elastichsearch Document.
If you have any question please comment or contact me.
Author: @NHB Khanh
📚 Recommended Books
Clean Code:Book
HTTP: The Definitive Guide
Clean architecture: Book
📱 Social Media
Blog: KhanhNHB Tech
Twitter: KhanhNHB
Email: [email protected]
30