- docker下载elasticsearch镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.6.0
2.docker创建网络, 方便关联Elasticsearch和Kibana
docker network create elastic
3.运行elasticsearch服务
docker run --name es01 \
-e ES_JAVA_OPTS="-Xms1g -Xmx1g" \
-e "discovery.type=single-node" \
--net elastic -p 9200:9200 -p 9300:9300 \
-d docker.elastic.co/elasticsearch/elasticsearch:8.6.0
4.重置密码
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password
5.复制 http_ca.crt 证书文件到本地
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
6.测试访问
curl --cacert http_ca.crt -u elastic https://localhost:9200
7.设置JVM参数
docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="<token>" --name es01 -p 9201:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.6.0
8.docker拉取kibana镜像
docker pull docker.elastic.co/kibana/kibana:8.6.0
9.启动kibana服务
docker run --name kib01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.6.0
10.docker卸载
docker network rm elastic
docker rm es01
docker rm kib01