docker安装elastic
时间: 2023-11-08 09:03:50 浏览: 119
docker-compose安装elasticsearch集群.docx
可以按照以下步骤在docker中安装elastic:
1. 使用docker拉取elastic image:`docker pull docker.elastic.co/elasticsearch/elasticsearch:<version>`
2. 创建一个新的容器并运行elastic:`docker run -d --name <container_name> -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:<version>`
其中,`<version>`为elastic的版本号,`<container_name>`为你自己指定的容器名称。
3. 验证elastic是否运行成功:在浏览器中访问http://localhost:9200/,如果返回类似以下的JSON格式响应,则说明elastic已经安装并运行成功:
```
{
"name" : "xxx",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "xxx",
"version" : {
"number" : "7.12.1",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "3186837139b9c6b6d23c3200870651f10d3343b3",
"build_date" : "2021-04-20T20:56:39.040728659Z",
"build_snapshot" : false,
"lucene_version" : "8.8.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
```
阅读全文