安装ElasticSearch
[root@play ~]``# docker pull elasticsearch:7.4.2
7.4.2: Pulling from library``/elasticsearch
d8d02d457314: Pull complete
f26fec8fc1eb: Pull complete
8177ad1fe56d: Pull complete
d8fdf75b73c1: Pull complete
47ac89c1da81: Pull complete
fc8e09b48887: Pull complete
367b97f47d5c: Pull complete
Digest: sha256:543bf7a3d61781bad337d31e6cc5895f16b55aed4da48f40c346352420927f74
Status: Downloaded newer image ``for` `elasticsearch:7.4.2
docker.io``/library/elasticsearch``:7.4.2
[root@play ~]``# free -m
``total used ``free` `shared buff``/cache` `available
Mem: 7821 2802 476 16 4542 4703
Swap: 1639 11 1628
[root@play ~]# mkdir -p /opt/elasticsearch/config
[root@play ~]# mkdir -p /opt/elasticsearch/data
[root@play ~]# echo "http.host: 0.0.0.0" > /opt/elasticsearch/config/elasticsearch.yml
[root@play ~]# cat /opt/elasticsearch/config/elasticsearch.yml
http.host: 0.0.0.0
[root@play ~]# docker run --name elasticsearch -p 9200:9200 -p 9300:9300 --privileged=true \
> -e "discovery.type=single-node" \
> -e ES_JAVA_OPTS="-Xms64m -Xms512m" \
> -v /opt/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
> -v /opt/elasticsearch/data:/usr/share/elasticsearch/data \
> -v /opt/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
> -d elasticsearch:7.4.2
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 --privileged=true \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xms512m" \
-v /opt/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /opt/elasticsearch/data:/usr/share/elasticsearch/data \
-v /opt/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2
但是会报错显示权限不足
赋予读写执行权限
chmod -R 777 /opt/elasticsearch/
如果是centOS的话,还要配置安全组才能访问
安装kibana
[root@play elasticsearch]# docker pull kibana:7.4.2
7.4.2: Pulling from library/kibana
d8d02d457314: Already exists
bc64069ca967: Pull complete
c7aae8f7d300: Pull complete
8da0971e3b41: Pull complete
58ea4bb2901c: Pull complete
b1e21d4c2a7e: Pull complete
3953eac632cb: Pull complete
5f4406500758: Pull complete
340d85e0d1c7: Pull complete
1768564d16fb: Pull complete
Digest: sha256:355f9c979dc9cdac3ff9a75a817b8b7660575e492bf7dbe796e705168f167efc
Status: Downloaded newer image for kibana:7.4.2
docker.io/library/kibana:7.4.2
[root@play elasticsearch]#docker run --name kibana -e ELASTICSEARCH_HOSTS=http:自己的ip:9200 -p 5601:5601 -d kibana:7.4.2
02569f8df4a2ac8548308661c517eb8979de96ce9345400a58a78a5d1ea7ca2b
kibana:7.4.2
02569f8df4a2ac8548308661c517eb8979de96ce9345400a58a78a5d1ea7ca2b