1、下载镜像:
docker pull index.docker.io/library/elasticsearch:2.3.3

2、修改配置文件:
config.zip
分别创建目录:
/usr/share/elasticsearch/config
/usr/share/elasticsearch/data
config目录中创建文件:elasticsearch.yml ,内容如下:
-------------------------------------------------- elasticsearch.yml内容 -------------------------------------------------
network.host: 192.168.10.136
-------------------------------------------------- elasticsearch.yml内容 -------------------------------------------------
config目录中创建文件:logging.yml,内容入下
-------------------------------------------------- logging.yml内容 ------------------------------------------------------
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
es.logger.level: INFO
rootLogger: ${es.logger.level}, console
logger:
# log action execution errors for easier debugging
action: DEBUG
# reduce the logging for aws, too much is logged under the default INFO
com.amazonaws: WARN

appender:
console:
type: console
layout:
type: consolePattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
-------------------------------------------------- logging.yml内容 ------------------------------------------------------
3、启动镜像
$ docker run -d -v "$PWD/config":/usr/share/elasticsearch/config -v "$PWD/esdata":/usr/share/elasticsearch/data elasticsearch:2.3.3

4、访问地址检查是否启动成功
$ curl 192.168.10.136:9200
得到结果如下:
{
"name" : "Devastator",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.3",
"build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",
"build_timestamp" : "2016-05-17T15:40:04Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}



Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐