当前位置:   article > 正文

docker出现问题:启动nexus时报错mkdir: cannot create directory : Permission denied解决方案_mkdir: cannot create directory '../sonatype-work/n

mkdir: cannot create directory '../sonatype-work/nexus3/log': permission den

docker使用教程相关系列 目录


 

问题:

启动nexus时报错mkdir: cannot create directory ‘../sonatype-work/nexus3‘: Permission denied

没有权限创建

  1. mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
  2. mkdir: cannot create directory '../sonatype-work/nexus3/tmp': Permission denied
  3. OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No such file or directory
  4. Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
  5. Warning: Forcing option -XX:LogFile=/tmp/jvm.log
  6. java.io.FileNotFoundException: ../sonatype-work/nexus3/tmp/i4j_ZTDnGON8hezynsMX2ZCYAVDtQog=.lock (No such file or directory)
  7. at java.io.RandomAccessFile.open0(Native Method)
  8. at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
  9. at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
  10. at com.install4j.runtime.launcher.util.SingleInstance.check(SingleInstance.java:72)
  11. at com.install4j.runtime.launcher.util.SingleInstance.checkForCurrentLauncher(SingleInstance.java:31)
  12. at com.install4j.runtime.launcher.UnixLauncher.checkSingleInstance(UnixLauncher.java:88)
  13. at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:67)
  14. java.io.FileNotFoundException: /nexus-data/karaf.pid (Permission denied)
  15. at java.io.FileOutputStream.open0(Native Method)
  16. at java.io.FileOutputStream.open(FileOutputStream.java:270)
  17. at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
  18. at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
  19. at org.apache.karaf.main.InstanceHelper.writePid(InstanceHelper.java:127)
  20. at org.apache.karaf.main.Main.launch(Main.java:243)
  21. at org.sonatype.nexus.karaf.NexusMain.launch(NexusMain.java:113)
  22. at org.sonatype.nexus.karaf.NexusMain.main(NexusMain.java:52)
  23. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  24. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  25. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  26. at java.lang.reflect.Method.invoke(Method.java:498)
  27. at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
  28. at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:69)
  29. java.lang.RuntimeException: /nexus-data/log/karaf.log (No such file or directory)
  30. at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal(BootstrapLogManager.java:102)
  31. at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInternal(BootstrapLogManager.java:137)
  32. at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(BootstrapLogManager.java:70)
  33. at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(BootstrapLogManager.java:75)
  34. at org.apache.karaf.main.Main.launch(Main.java:244)
  35. at org.sonatype.nexus.karaf.NexusMain.launch(NexusMain.java:113)
  36. at org.sonatype.nexus.karaf.NexusMain.main(NexusMain.java:52)
  37. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  38. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  39. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  40. at java.lang.reflect.Method.invoke(Method.java:498)
  41. at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
  42. at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:69)
  43. Caused by: java.io.FileNotFoundException: /nexus-data/log/karaf.log (No such file or directory)
  44. at java.io.FileOutputStream.open0(Native Method)
  45. at java.io.FileOutputStream.open(FileOutputStream.java:270)
  46. at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
  47. at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.open(BootstrapLogManager.java:193)
  48. at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.<init>(BootstrapLogManager.java:182)
  49. at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal(BootstrapLogManager.java:100)
  50. ... 12 more
  51. Error creating bundle cache.

解决方案:

先把容器删除

docker rm nexus

再运行启动新命令

在原先的命令基础上加了“--privileged=true”

docker run -p 8081:8081 --privileged=true --name nexus -v /usr/local/docker/nexus/nexus-data:/nexus-data 8716903d1912

注:--privileged,该参数可以设置是否给docker容器特权,如果该参数为true,使得docker容器内的root权限为宿主机的root权限,而非只是容器内的root权限

看下服务是否启动正常

docker ps

0

为挂载的路径赋权限:

chmod 777 /usr/local/docker/nexus/nexus-data

场景:

给技术经理找了几款Docker开源镜像仓库,为什么经理选中了Sonatype Nexus(上)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/89484
推荐阅读
相关标签
  

闽ICP备14008679号