问题原因:宿主中 /usr/share/elasticsearch/data/nodes没有操作权限,对应的主机/opt/workspace/work/es/single没有操作权限

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" \
-d -p 9200:9200 -p 9300:9300 \
-v /opt/workspace/work/es/single/config/es-single.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /opt/workspace/work/es/single/data:/usr/share/elasticsearch/data  \
--name st_es elasticsearch:7.14.2

查看问题文件

➜  ~ cd /opt/workspace/work/es/single
➜  single ls -al
total 0
drwxr-xr-x  4 root  wheel  128 10 18 09:07 .
drwxr-xr-x  3 root  wheel   96 10 18 09:06 ..
drwxr-xr-x  3 root  wheel   96 10 18 09:09 config
drwxr-xr-x  2 root  wheel   64 10 18 09:07 data

修改权限:

➜  single sudo chmod -R 777 config
Password:
➜  single sudo chmod -R 777 data
➜  single ls -al                
total 0
drwxr-xr-x  4 root  wheel  128 10 18 09:07 .
drwxr-xr-x  3 root  wheel   96 10 18 09:06 ..
drwxrwxrwx  3 root  wheel   96 10 18 09:09 config
drwxrwxrwx  2 root  wheel   64 10 18 09:07 data
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐