我想在docker上运行SonarQube。当我运行whiteout volume持久选项时,它可以通过以下命令正常工作:
docker run -d --name sonarqube -p 9000:9000 sonarqube
但是当我尝试设置绑定安装的永久卷时,我的docker无法启动。使用的docker命令为:
docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube
注意:我以root特权运行docker命令。
我使用了来自Docker Hub的SonarQube图像:https://hub.docker.com/_/sonarqube?tab=description
我在docker日志中收到此错误:
> 06:42:37.293 [main]警告org.sonar.application.config.AppSettingsLoaderImpl-找不到配置文件:/opt/sonarqube/conf/sonar.properties 2019.07.07 06:42:37 INFO应用程序[] [o.s.a.AppFileSystem]清洁或创建临时目录/ opt / sonarqube / temp 2019.07.07 06:42:37 INFO应用程序[] [o.s.a.es.EsSettings] Elasticsearch监听/127.0.0.1:9001 2019.07.07 06:42:37 INFO应用程序[] [osaProcessLauncherImpl]启动过程[[key ='es',ipcIndex = 1,logFilenamePrefix = es]]来自[/ opt / sonarqube / elasticsearch]:/ opt / sonarqube / elasticsearch / bin / elasticsearch 2019.07.07 06:42:38 INFO应用程序[] [o.s.a.SchedulerImpl]等待Elasticsearch启动并运行 OpenJDK 64位服务器VM警告:选项UseConcMarkSweepGC在9.0版中已弃用,将来可能会删除。 2019.07.07 06:42:38 INFO应用程序[] [o.e.p.PluginsService]未加载任何模块 2019.07.07 06:42:38 INFO应用[] [o.e.p.PluginsService]加载了插件[org.elasticsearch.transport.Netty4Plugin]
2019-07-07 06:42:41,143主要错误无法创建文件/opt/sonarqube/logs/es.log java.io.IOException:权限被拒绝 在java.base / java.io.UnixFileSystem.createFileExclusively(本机方法) 在java.base / java.io.File.createNewFile(File.java:1024) 在org.apache.logging.log4j.core.appender.rolling.RollingFileManager $ RollingFileManagerFactory.createManager(RollingFileManager.java:628) 在org.apache.logging.log4j.core.appender.rolling.RollingFileManager $ RollingFileManagerFactory.createManager(RollingFileManager.java:608) 在org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113) 在org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) 在org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188) 在org.apache.logging.log4j.core.appender.RollingFileAppender $ Builder.build(RollingFileAppender.java:145) 在org.apache.logging.log4j.core.appender.RollingFileAppender $ Builder.build(RollingFileAppender.java:61) 在org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891) 在org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514) 在org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238) 在org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250) 在org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) 在org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127) 在org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302) 在org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) 在org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) 在org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) 在org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) 在org.elasticsearch.cli.Command.main(Command.java:90) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,148主要错误无法为元素RollingFile创建类型为org.apache.logging.log4j.core.appender.RollingFileAppender类型的插件:java.lang.IllegalStateException:ManagerFactory [org.apache .logging.log4j.core.appender.rolling.RollingFileManager $ RollingFileManagerFactory @ 5dcd8c7a]无法使用数据[org.apache.logging.log4j.core.appender.rolling为[/opt/sonarqube/logs/es.log]创建管理器.RollingFileManager $ FactoryData @ 2250b9f2 [pattern = / opt / sonarqube / logs / es。%d {yyyy-MM-dd} .log,append = true,bufferedIO = true,bufferSize = 8192,policy = CompositeTriggeringPolicy(policies = [TimeBasedTriggeringPolicyy (nextRolloverMillis = 0,interval = 1,modulate = true)]),strategy = DefaultRolloverStrategy(min = -2147483648,max = 2147483647,useMax = false),advertiseURI = null,layout =%d {yyyy.MM.dd HH: mm:ss}%-5level es [] [%logger {1。}]%msg%n,filePermissions = null,fileOwner = null]] java.lang.IllegalStateException:ManagerFactory [org.apache.logging.log4j.core。 appender.rolling.RollingFileMa nager $ RollingFileManagerFactory @ 5dcd8c7a]无法使用数据[org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@2250b9f2 [pattern = / opt]为[/opt/sonarqube/logs/es.log]创建管理器/sonarqube/logs/es.%d{yyyy-MM-dd}.log,append=true,bufferedIO=true,bufferSize=8192,policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0,interval=1,modulate= true)]),strategy = DefaultRolloverStrategy(min = -2147483648,max = 2147483647,useMax = false),advertiseURI = null,layout =%d {yyyy.MM.dd HH:mm:ss}%-5level es [] [ %logger {1。}]%msg%n,filePermissions = null,fileOwner = null]] 在org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:115) 在org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) 在org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188) 在org.apache.logging.log4j.core.appender.RollingFileAppender $ Builder.build(RollingFileAppender.java:145) 在org.apache.logging.log4j.core.appender.RollingFileAppender $ Builder.build(RollingFileAppender.java:61) 在org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891) 在org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514) 在org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238) 在org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250) 在org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) 在org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127) 在org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302) 在org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) 在org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) 在org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) 在org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) 在org.elasticsearch.cli.Command.main(Command.java:90) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,152主要错误无法为元素RollingFile调用类org.apache.logging.log4j.core.appender.RollingFileAppender中的工厂方法:java.lang.IllegalStateException:找不到以下工厂方法org.apache.logging.log4j.core.appender.RollingFileAppender类java.lang.IllegalStateException:找不到org.apache.logging.log4j.core.appender.RollingFileAppender类的工厂方法 在org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:235) 在org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899) 在org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891) 在org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514) 在org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238) 在org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250) 在org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547) 在org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234) 在org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127) 在org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302) 在org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) 在org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) 在org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) 在org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) 在org.elasticsearch.cli.Command.main(Command.java:90) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) 在org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,154主要错误为Appenders中的RollingFile返回空对象。 2019-07-07 06:42:41,154主要错误无法找到记录器配置“根”的附加程序“ file_es” 2019.07.07 06:42:41 WARN app [] [o.s.a.p.AbstractManagedProcess]进程退出,退出值为[es]:1 2019.07.07 06:42:41 INFO应用程序[] [o.s.a.SchedulerImpl]进程已停止 2019.07.07 06:42:41 INFO应用[] [o.s.a.SchedulerImpl] SonarQube已停止
答案 0 :(得分:0)
我认为您已永久保留卷,但是没有文件和必需的权限。请遵循以下步骤。
$ docker run -d --name sonarqube -p 9000:9000 sonarqube
$ docker ps -f name=sonarqube
记下容器ID。
$ cd /opt/docker-mounts/sonaarqube
$ chown -R 999:999 .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/conf .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/logs . # this can be skipped is not required
$ docker cp -a CONTAINER_ID:/opt/sonarqube/data . # optional, if you need the existing data from the container
$ docker cp -a CONTAINER_ID:/opt/sonarqube/extensions .
$ docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube