'SonarQube Docker Installation CorruptIndexException: checksum failed

I'm trying to create docker container with SonarQube inside it, but I get this error while composing for the first time:

Caused by: java.util.concurrent.ExecutionException: org.apache.lucene.index.CorruptIndexException: checksum failed (hardware problem?) : expected=f736ed01 actual=298dcde2 (resource=BufferedChecksumIndexInput(NIOFSIndexInput(path="/opt/sonarqube/data/es7/nodes/0/_state/_7w.fdt")))

I tried installing it on a fresh instance with fresh docker installation, I even tried to install it on a different server to rule out hardware failure, and I still get the same error. What could be the cause of it?

docker-compose.yml

version: "3"

services:
  sonarqube:
    image: sonarqube:community
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
    ports:
      - "9000:9000"
  db:
    image: postgres:12
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

volumes:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  postgresql:
  postgresql_data:


Solution 1:[1]

As stated in this issue from the Docker-Sonarqube repository:

This bug appeared when the alpine base image has been updated to 3.14.5+. So you have two choices for now:

  • Either rollback Sonarqube 9.2.4 (prior versions have the Log4J vulnerability)
  • Re-build the latest Sonarqube image yourself with alpine version set to 3.14.3 (as explained in this comment)

Solution 2:[2]

Solved it by using image: sonarqube:9.2.4-developer

Solution 3:[3]

If its running docker inside a vm, try to enable nested virtualization for the vm.

Link to understand nested virt (https://cloud.google.com/compute/docs/instances/nested-virtualization/overview)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lord Grosse Jeanine
Solution 2 jojo5050
Solution 3 eduardoj