Problems updating Sonarqube from 8.9 to 9.0 in the docker

I’m running Sonarqube 8.9 in Docker-compose. I need to update to 9.0 and save the data from the Database (default).

I store data from the Sonarqube 8.9 working container using a cmd:

docker cp container_name:/opt/sonarqube/data C:\Users\root\Documents\Projects\sonarqube\docs
docker cp container_name:/opt/sonarqube/conf C:\Users\root\Documents\Projects\sonarqube\docs
docker cp container_name:/opt/sonarqube/temp C:\Users\root\Documents\Projects\sonarqube\docs
docker cp container_name:/opt/sonarqube/logs C:\Users\root\Documents\Projects\sonarqube\docs
docker cp container_name:/opt/sonarqube/extensions C:\Users\root\Documents\Projects\sonarqube\docs

And I transfer them at start of Sonarqube 9.0 in docker-compose.yml

version: "3"
services:
  sonarqube:
    image: sonarqube:9.0-community
    ports:
      - "9000:9000"
    volumes:
      - ./docs/temp:/opt/sonarqube/conf
      - ./docs/data:/opt/sonarqube/data
      - ./docs/extensions:/opt/sonarqube/extensions
      - ./docs/logs:/opt/sonarqube/logs
      - ./docs/temp:/opt/sonarqube/temp

Docker container stops.
Logs:


`08:43:17.071 [main] WARN org.sonar.application.config.AppSettingsLoaderImpl - Configuration file not found: /opt/sonarqube/conf/sonar.properties`
`2021.12.03 08:43:17 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp`
`2021.12.03 08:43:17 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:33559]`
`2021.12.03 08:43:17 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch`
`2021.12.03 08:43:17 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running`
`warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release`
`OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.`
`2021.12.03 08:43:20 INFO  es[][o.e.n.Node] version[7.12.1], pid[39], build[default/tar/3186837139b9c6b6d23c3200870651f10d3343b7/2021-04-20T20:56:39.040728659Z], OS[Linux/5.10.60.1-microsoft-standard-WSL2/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/11.0.11/11.0.11+9]`
`2021.12.03 08:43:20 INFO  es[][o.e.n.Node] JVM home [/opt/java/openjdk]`
`2021.12.03 08:43:20 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=COMPAT, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube/elasticsearch, -Des.path.conf=/opt/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=false]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] loaded module [percolator]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]`
`2021.12.03 08:43:21 INFO  es[][o.e.p.PluginsService] no plugins loaded`
`2021.12.03 08:43:21 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/opt/sonarqube/data (C:\)]], net usable_space [361.2gb], net total_space [476.3gb], types [9p]`
`2021.12.03 08:43:21 INFO  es[][o.e.e.NodeEnvironment] heap size [494.9mb], compressed ordinary object pointers [true]`
`2021.12.03 08:43:22 ERROR es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]`
`org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: IndexFormatTooNewException[Format version is not supported (resource SimpleFSIndexInput(path="/opt/sonarqube/data/es7/nodes/0/_state/_7j.cfs") [slice=_7j.fdt]): 4 (needs to be between 1 and 3)];`
`at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.12.1.jar:7.12.1]`
`at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.12.1.jar:7.12.1]`
`Caused by: org.elasticsearch.ElasticsearchException: failed to bind service`
`at org.elasticsearch.node.Node.<init>(Node.java:744) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.node.Node.<init>(Node.java:278) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.1.jar:7.12.1]`
`... 6 more`
`Caused by: org.apache.lucene.index.IndexFormatTooNewException: Format version is not supported (resource SimpleFSIndexInput(path="/opt/sonarqube/data/es7/nodes/0/_state/_7j.cfs") [slice=_7j.fdt]): 4 (needs to be between 1 and 3)`
`at org.apache.lucene.codecs.CodecUtil.checkHeaderNoMagic(CodecUtil.java:216) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.codecs.CodecUtil.checkHeader(CodecUtil.java:198) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.codecs.CodecUtil.checkIndexHeader(CodecUtil.java:255) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.codecs.compressing.CompressingStoredFieldsReader.<init>(CompressingStoredFieldsReader.java:130) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.codecs.compressing.CompressingStoredFieldsFormat.fieldsReader(CompressingStoredFieldsFormat.java:123) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.codecs.lucene87.Lucene87StoredFieldsFormat.fieldsReader(Lucene87StoredFieldsFormat.java:131) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.SegmentCoreReaders.<init>(SegmentCoreReaders.java:127) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:83) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:66) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:58) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:720) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:81) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63) ~[lucene-core-8.8.0.jar:8.8.0 b10659f0fc18b58b90929cfdadde94544d202c4a - noble - 2021-01-25 19:07:45]`
`at org.elasticsearch.gateway.PersistedClusterStateService.nodeMetadata(PersistedClusterStateService.java:256) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.env.NodeEnvironment.loadNodeMetadata(NodeEnvironment.java:399) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:320) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.node.Node.<init>(Node.java:352) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.node.Node.<init>(Node.java:278) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[elasticsearch-7.12.1.jar:7.12.1]`
`at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.1.jar:7.12.1]`
`... 6 more`
`uncaught exception in thread [main]`
`ElasticsearchException[failed to bind service]; nested: IndexFormatTooNewException[Format version is not supported (resource SimpleFSIndexInput(path="/opt/sonarqube/data/es7/nodes/0/_state/_7j.cfs") [slice=_7j.fdt]): 4 (needs to be between 1 and 3)];`
`Likely root cause: org.apache.lucene.index.IndexFormatTooNewException: Format version is not supported (resource SimpleFSIndexInput(path="/opt/sonarqube/data/es7/nodes/0/_state/_7j.cfs") [slice=_7j.fdt]): 4 (needs to be between 1 and 3)`
`at org.apache.lucene.codecs.CodecUtil.checkHeaderNoMagic(CodecUtil.java:216)`
`at org.apache.lucene.codecs.CodecUtil.checkHeader(CodecUtil.java:198)`
`at org.apache.lucene.codecs.CodecUtil.checkIndexHeader(CodecUtil.java:255)`
`at org.apache.lucene.codecs.compressing.CompressingStoredFieldsReader.<init>(CompressingStoredFieldsReader.java:130)`
`at org.apache.lucene.codecs.compressing.CompressingStoredFieldsFormat.fieldsReader(CompressingStoredFieldsFormat.java:123)`
`at org.apache.lucene.codecs.lucene87.Lucene87StoredFieldsFormat.fieldsReader(Lucene87StoredFieldsFormat.java:131)`
`at org.apache.lucene.index.SegmentCoreReaders.<init>(SegmentCoreReaders.java:127)`
`at org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:83)`
`at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:66)`
`at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:58)`
`at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:720)`
`at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:81)`
`at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63)`
`at org.elasticsearch.gateway.PersistedClusterStateService.nodeMetadata(PersistedClusterStateService.java:256)`
`at org.elasticsearch.env.NodeEnvironment.loadNodeMetadata(NodeEnvironment.java:399)`
`at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:320)`
`at org.elasticsearch.node.Node.<init>(Node.java:352)`
`at org.elasticsearch.node.Node.<init>(Node.java:278)`
`at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:217)`
`at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217)`
`at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397)`
`at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)`
`at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)`
`at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)`
`at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116)`
`at org.elasticsearch.cli.Command.main(Command.java:79)`
`at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)`
`at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81)`
`For complete error details, refer to the log at /opt/sonarqube/logs/sonarqube.log`
`2021.12.03 08:43:22 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1`
`2021.12.03 08:43:22 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped`
`2021.12.03 08:43:22 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped`

Hello @Andrew56

  • the volumes you need to map are documented. The conf and temp directory folders should not be mounted.
  • parameters for your docker instance are set with environment variables, directly from your compose file.
  • you may re-use the extensions volume, provided that all of the extensions you had on 8.9 are still compatible with 9.x.
  • Your error is from the elasticsearch component, which is unhappy about some data it finds at start on SonarQube 9. This was not expected but should be easily solved by providing an initially empty data volume (the indexes are rebuilt anyway from the DB during upgrades)
  • SonarQube 9.0 was deprecated when we released SonarQube 9.2 in November. And you have a direct upgrade path from the 8.9 to the 9.2.1.

Hope this helps
Sylvain