docker中启动elasticsearch报错:Error opening log file 'logs/gc.log': Permission denied
原创 2020-03-24 15:16 阅读(7703)次
最近公司组织学习elasticsearch,于是自己又重温了一下es,由于没有环境,又重新在docker安装了一下elasticsearch,启动命令如下:
docker run --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" -v /home/docker/es/plugins:/usr/share/elasticsearch/plugins -v /home/docker/es/data:/usr/share/elasticsearch/data -v /home/docker/es/logs:/usr/share/elasticsearch/logs elasticsearch:7.1.0
启动报错:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[0.001s][error][logging] Error opening log file 'logs/gc.log': Permission denied
[0.001s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.
看了下是权限问题,于是在启动命令上加上--privileged=true参数,还是报这个错。于是想了下应该是挂载的目录权限问题,于是给/home/docker/es/plugins
/home/docker/es/data
/home/docker/es/logs
都执行了chmod 777 权限操作,再次启动就OK了