docker-compose elasticsearch8.6.2 kibana8.6.2
时间: 2023-11-17 21:08:32 浏览: 100
Here is an example `docker-compose.yml` file to run Elasticsearch 8.6.2 and Kibana 8.6.2 using Docker Compose:
```yaml
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.6.2
container_name: elasticsearch
environment:
- discovery.type=single-node
ports:
- "9200:9200"
volumes:
- esdata:/usr/share/elasticsearch/data
kibana:
image: docker.elastic.co/kibana/kibana:8.6.2
container_name: kibana
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
volumes:
esdata:
```
In this example, we define two services: `elasticsearch` and `kibana`. The `elasticsearch` service uses the official Elasticsearch 8.6.2 Docker image, sets the `discovery.type` environment variable to `single-node` (to run a single Elasticsearch node), maps port 9200 to the host machine, and creates a volume named `esdata` to persist Elasticsearch data.
The `kibana` service uses the official Kibana 8.6.2 Docker image, maps port 5601 to the host machine, and sets the `ELASTICSEARCH_HOSTS` environment variable to the hostname of the `elasticsearch` service (which is `http://elasticsearch:9200`).
To run these services, navigate to the directory where the `docker-compose.yml` file is located and run the following command:
```bash
docker-compose up -d
```
This will start both services in detached mode (in the background). To stop the services, run the following command:
```bash
docker-compose down
```
Note that you may need to adjust the configuration options (such as ports and environment variables) to fit your specific use case.
阅读全文