1.下载ES镜像
docker pull elasticsearch
2.拷贝配置文件到本地
docker run -it --name es -d -p 9200:9200 -p 9300:9300 -p 5601:5601 -v /etc/localtime:/etc/localtime elasticsearch
docker cp es:/usr/share/elasticsearch/bin /usr/local/soft/elasticsearch
docker cp es:/usr/share/elasticsearch/config /usr/local/soft/elasticsearch
docker stop es
docker rm es
3.启动
docker run -it --name es -d \
-p 9200:9200 -p 9300:9300 -p 5601:5601 \
-v /etc/localtime:/etc/localtime \
-v /usr/local/soft/elasticsearch/bin/:/usr/share/elasticsearch/bin/ \
-v /usr/local/soft/elasticsearch/config/:/usr/share/elasticsearch/config/ \
elasticsearch
4.安装kibana并共享es网络
docker run --name kibana -it -d -e ELASTICSEARCH_URL=http://127.0.0.1:9200 -v /etc/localtime:/etc/localtime --network=container:es kibana
访问http://127.0.0.1:5601