当我在docker容器中启动nexus3时,我得到以下错误消息。
$ docker run --rm sonatype/nexus3:3.8.0
Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning: Forcing option -XX:LogFile=/tmp/jvm.log
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
Unable to update instance pid: Unable to create directory /nexus-data/instances
/nexus-data/log/karaf.log (Permission denied)
Unable to update instance pid: Unable to create directory /nexus-data/instances表示存在文件权限问题。我使用Red Hat Enterprise Linux 7.5作为主机和最新的docker版本。
在另一台机器(ubuntu)上,它工作正常。
永久卷(/nexus-data)中出现问题。但是,我不会挂载特定卷并让docker使用匿名卷。
如果我比较两台计算机上的卷,我可以看到以下权限:
对于Red Hat,它不工作的地方是属于root。
$ docker run --rm sonatype/nexus3:3.8.0 ls -l /nexus-data
total 0
drwxr-xr-x. 2 root root 6 Mar 1 00:07 etc
drwxr-xr-x. 2 root root 6 Mar 1 00:07 log
drwxr-xr-x. 2 root root 6 Mar 1 00:07 tmp在ubuntu上,它工作的地方属于nexus.Nexus也是容器中的默认用户。
$ docker run --rm sonatype/nexus3:3.8.0 ls -l /nexus-data
total 12
drwxr-xr-x 2 nexus nexus 4096 Mar 1 00:07 etc
drwxr-xr-x 2 nexus nexus 4096 Mar 1 00:07 log
drwxr-xr-x 2 nexus nexus 4096 Mar 1 00:07 tmp不能使用选项-u更改用户。
发布于 2018-07-06 20:32:35
我可以通过删除所有本地docker镜像来解决这个问题:docker image prune -a
之后,它再次下载了该图像,并成功运行。这很奇怪,因为我还比较了图像的指纹,发现它们是相同的。
发布于 2019-06-13 15:08:18
您应该将正确的权限分配给持久卷所在的文件夹。
chmod u+wxr -R <folder of /nexus-data volumes>请小心,如果您执行上一条命令,它将授予所有用户写、读和执行权。如果你想给出更多的限制权限,你应该修改命令。
https://stackoverflow.com/questions/51209615
复制相似问题