Article directory
Preparation before installation
Create mounting directory
Used to mount logs, data, etc. on the host.
Create the /opt/es/data directory
. Create the /opt/es/logs directory.
Create the /opt/es/plugins directory
. Create the /opt/es/conf directory.
mkdir -p /opt/es/{data,logs,plugins,conf}
Authorization related permissions
chmod -R 777 /opt/es/data
chmod -R 777 /opt/es/logs
chmod -R 777 /opt/es/conf
chmod -R 777 /opt/es/plugins
Create elasticsearch.yml file
vim /opt/es/conf/elasticsearch.yml
content
http.host: 0.0.0.0
Pull image
docker pull elasticsearch:7.17.2
Run container
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms84m -Xmx512m" \
-v /opt/es/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /opt/es/data:/usr/share/elasticsearch/data \
-v /opt/es/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.17.2
Check operation status
Run successfully
test
URL: IP:9200
and the following screen will appear.