-e "ES_JAVA_OPTS=-Xms512m -Xmx512m": Specifies the JVM memory, default is 1T -e "discovery.type=single-node": Specifies the startup mode as single-node mode -v es-data:: Specifies the data storage directory -v es-plugins:: Specifies the plugin directory --network es-network: Specifies the network -p 9200:9200: Maps the port for HTTP protocol interface -p 9300:9300: Maps the port for communication between nodes
Kibana needs to be in the same network as Elasticsearch
Pulling the image
This example deploys version 7.12.1
1
docker pull kibana:7.12.1
Running the container
-e ELASTICSEARCH_HOSTS=http://es:9200: Specifies the address of the Elasticsearch container. If not specified, the default value is http://elasticsearch:9200 --network es-network: Specifies the network
Elasticsearch’s default analyzer is not very good for Chinese, so you can use medcl/elasticsearch
1 2 3 4
docker exec -it es /bin/bash ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip exit docker restart es
Manually downloading ik analyzer
If the network is not good, you can manually download the ik analyzer and put it in the plugin directory of Elasticsearch. Then re-run the installation operation and it will skip the download automatically
Restart Elasticsearch to complete the plugin loading
docker exec -it es /bin/bash ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip exit docker restart es
Alternatively, you can manually unzip and restart Elasticsearch to complete the plugin loading
1 2 3 4 5
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip mv ./elasticsearch-analysis-ik-7.12.1.zip /root/es/es-plugins/ cd /root/es/es-plugins/ unzip elasticsearch-analysis-ik-7.12.1.zip docker restart es
If it is an Elasticsearch cluster, the entire cluster needs to be restarted after installing the plugin to complete the plugin loading.
Deploying pinyin analyzer
Querying Chinese word groups using the initials of Chinese pinyin
1 2 3 4
docker exec -it es /bin/bash ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v7.12.1/elasticsearch-analysis-pinyin-7.12.1.zip exit docker restart es
Pitfalls
Error when pulling Kibana image: no matching manifest for linux/arm64/v8 in the manifest list entries
Cause
Incompatibility between Apple Silicon and Intel
Solution
Force pulling the x86_64 architecture image
--platform linux/x86_64: If there are multiple versions of the image for different architectures, specify the architecture to pull
1
docker pull --platform linux/x86_64 kibana:7.12.1
Pitfalls
After running the Kibana container, the access to the management page is unsuccessful, with frontend error: Kibana server is not ready yet, and backend errors: License information could not be obtained from Elasticsearch due to Error: No Living connections and Unable to retrieve version information from Elasticsearch nodes.
Cause
Incorrect Elasticsearch address configured in Kibana
The default value of Elasticsearch address configured in the file config/kibana.yml is elasticsearch.hosts: [ "http://elasticsearch:9200" ]
Solution
Method 1
Change the name of Elasticsearch to elasticsearch when starting it
Method 2
Modify the configuration of Elasticsearch address in the file config/kibana.yml
Method 3
Specify the environment variable -e ELASTICSEARCH_HOSTS=http://es:9200 when running the container, based on the current Elasticsearch address