1、es容器内文件挂载在宿主机 启动报错
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:290: starting container process caused “container init exited prematurely”
[root@localhost ~]# docker run -p 9200:9200 -p 9300:9300 -v /home/admin/es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/admin/es/data:/usr/share/elasticsearch/data -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d --name m-es elasticsearch:5.6.11
3866800899c5fe7fe142ce4eaf39271ba422255a08bc011978b1f5ea70ecb95f
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:290: starting container process caused "container init exited prematurely".
2、原因:挂载的文件不存在,需先创建文件及文件夹
mkdir 创建文件夹
touch 创建文件
[root@localhost admin]# mkdir es
[root@localhost admin]# ls
es
[root@localhost admin]# cd es
[root@localhost es]# mkdir data
[root@localhost es]# ls
data
[root@localhost es]# touch elasticsearch.yml
[root@localhost es]# ls
data elasticsearch.yml