查询镜像
[root@0006 elasticsearch]# docker search elasticsearchINDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATEDdocker.io docker.io/elasticsearch Elasticsearch is a powerful open source se... 3521 [OK] docker.io docker.io/nshou/elasticsearch-kibana Elasticsearch-6.5.4 Kibana-6.5.4 96 [OK]docker.io docker.io/itzg/elasticsearch Provides an easily configurable Elasticsea... 67 [OK]docker.io docker.io/elastichq/elasticsearch-hq Official Docker image for ElasticHQ: Elast... 26 [OK]docker.io docker.io/kubernetes/fluentd-elasticsearch An image that ingests Docker container log... 25 docker.io docker.io/lmenezes/elasticsearch-kopf elasticsearch kopf 17 [OK]docker.io docker.io/bitnami/elasticsearch Bitnami Docker Image for Elasticsearch 16 [OK]docker.io docker.io/taskrabbit/elasticsearch-dump Import and export tools for elasticsearch 15 [OK]docker.io docker.io/esystemstech/elasticsearch Debian based Elasticsearch packing for Lif... 14 docker.io docker.io/monsantoco/elasticsearch ElasticSearch Docker image 11 [OK]docker.io docker.io/mesoscloud/elasticsearch [UNMAINTAINED] Elasticsearch 9 [OK]docker.io docker.io/blacktop/elasticsearch Alpine Linux based Elasticsearch Docker Image 8 [OK]docker.io docker.io/justwatch/elasticsearch_exporter Elasticsearch stats exporter for Prometheus 8 docker.io docker.io/centerforopenscience/elasticsearch Elasticsearch 4 [OK]docker.io docker.io/barchart/elasticsearch-aws Elasticsearch AWS node 3 docker.io docker.io/forkdelta/fluentd-elasticsearch fluent/fluentd with fluent-plugin-elastics... 1 [OK]docker.io docker.io/jetstack/elasticsearch-pet An elasticsearch image for kubernetes PetSets 1 [OK]docker.io docker.io/phenompeople/elasticsearch Elasticsearch is a powerful open source se... 1 [OK]docker.io docker.io/thingswise/elasticsearch Elasticsearch + etcd2 peer discovery 1 [OK]docker.io docker.io/18fgsa/elasticsearch Built from https://github.com/docker-libra... 0 docker.io docker.io/axway/elasticsearch-docker-beat "Beat" extension to read logs of container... 0 [OK]docker.io docker.io/driveclutch/infra-elasticsearch-aws Elasticsearch Docker for use in AWS 0 [OK]docker.io docker.io/igneoussystems/base-elasticsearch A base image containing 3p tools for elast... 0 docker.io docker.io/igneoussystems/base-elasticsearch-5 Base elasticsearch 5.1.1 container 0 docker.io docker.io/wreulicke/elasticsearch elasticsearch 0 [OK]
拉取镜像
[root@0006 elasticsearch]# docker pull elasticsearch:5.6.12Using default tag: latestTrying to pull repository docker.io/library/elasticsearch ... latest: Pulling from docker.io/library/elasticsearch05d1a5232b46: Pull complete 5cee356eda6b: Pull complete 89d3385f0fd3: Pull complete 65dd87f6620b: Pull complete 78a183a01190: Pull complete 1a4499c85f97: Pull complete 2c9d39b4bfc1: Pull complete 1b1cec2222c9: Pull complete 59ff4ce9df68: Pull complete 1976bc3ee432: Pull complete 5af49e8af381: Pull complete 42c8b75ff7af: Pull complete 7e6902915254: Pull complete 99853874fa54: Pull complete 596fbad6fcff: Pull complete Digest: sha256:a8081d995ef3443dc6d077093172a5931e02cdb8ffddbf05c67e01d348a9770eStatus: Downloaded newer image for docker.io/elasticsearch:latest
运行镜像
[root@0006 elasticsearch]# docker run -e ES_JAVA_OPTS="-Xms4G -Xmx4G" -d -p 9200:9200 -p 9300:9300 --restart=always -v /elasticsearch/data:/usr/share/elasticsearch/data --name elasticsearch docker.io/elasticsearch:5.6.124862c1bfee14081445a636d7d51c8b65607574d1881e6a41fb02272ad60a546f
//查看否是已经监听9200和9300[root@0006 elasticsearch]# netstat -tnplActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 1318/java tcp 0 0 0.0.0.0:5601 0.0.0.0:* LISTEN 644/node tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 6065/mysqld tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6688/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1032/sshd tcp6 0 0 :::9092 :::* LISTEN 3749/docker-proxy-c tcp6 0 0 :::10086 :::* LISTEN 85540/docker-proxy- tcp6 0 0 :::6732 :::* LISTEN 1291/dockerd-curren tcp6 0 0 :::9200 :::* LISTEN 104656/docker-proxy tcp6 0 0 :::50000 :::* LISTEN 68374/docker-proxy- tcp6 0 0 :::9300 :::* LISTEN 104645/docker-proxy tcp6 0 0 :::22 :::* LISTEN 1032/sshd
ES_JAVA_OPTS="-Xms4G -Xmx4G" //设置只允许4G的jvm运行空间
检查安装是否成功
[root@0006 ~]# curl http://172.16.10.383:9200/{ "name" : "gqsc0ge", "cluster_name" : "elasticsearch", "cluster_uuid" : "7KPSH7V6R-mBDaIHCetkDg", "version" : { "number" : "5.6.12", "build_hash" : "cfe3d9f", "build_date" : "2018-09-10T20:12:43.732Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search"}[root@0006 ~]#