Upgrade from 10.7.0-community to version 25.3.0.104237-community (Docker)

Hello colleagues,

We have a project here that implements Sonarqube Community and was deployed using docker/docker compose solution, as detailed in the code below.

services:
  sonarqube:
    image: sonarqube:sonarqube:10.7.0-community
    hostname: sonarqube
    container_name: sonarqube-embrapadevops
    restart: unless-stopped
    depends_on:
      - postdb
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://postdb:5432/sonar
      SONAR_JDBC_USERNAME: sonar_acesso_d
      SONAR_JDBC_PASSWORD: ${SONAR_DB_PASSWORD}
    volumes:
      - sonardata:/opt/sonarqube
    ports:
      - "9451:9000"
    networks:
      - devopsnet
  postdb:
    image: postgres:latest
    hostname: postgresql
    container_name: postgresql-embrapadevops
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD_FILE: /run/secrets/postgres_root_pass
    secrets:
      - postgres_root_pass
    volumes:
      - ${POSTGRESQL_CREATE_DATABASE}:/docker-entrypoint-initdb.d/create-databases.sh
      - postgresdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - devopsnet
networks:
  devopsnet:
    name: devopsnet
    external: true
secrets:
  postgres_root_pass:
    file: postgres_root_pass.txt
volumes:
  postgresdata:
    driver: local
    name: "embrapadevops_postgresdata"
    driver_opts:
      type: none
      o: bind
      device: ${POSTGRESQL}
  sonardata:
    driver: local
    name: "embrapadevops_sonardata"
    driver_opts:
      type: none
      o: bind
      device: ${SONARQUBE_DATA}

We recently tried to upgrade from version 10.7.0-community to version 25.3.0.104237-community, following the instructions available here.

However, even after removing and replacing the docker container version and accessing the setup page, no update was made and the system continues to display version 10.7.0 in the page footer. The setup page, when accessed, indicates that everything is up to date and that no changes are necessary. We did not identify any error messages in the console.

Could there be any step that we might have missed?

Hey there.

Just to be super clear – you’ve run docker compose down docker compose up?

Hi Colin,

Yes, I did. Before running compose up, I even removed the image from the previous container.

Thank you for your attention.

I’m not quite sure what to tell you! It seems like somehow you’re not actually pulling the latest docker image. In the state that you shared, it doesn’t seem you have a valid Docker Compose file.

There’s an extra sonarqube: here – it should just be sonarqube:10.7.0-community.

Putting that aside – I just tried it out myself and a simple docker-compose down, switching the image, docker-compose up worked as expected.

Are you absolutely sure that your SonarQube instance is being deployed by docker compose, and specifically this docker compose file? If you run docker-compose down, can you still access your SonarQube instance?

Hi Colin,

Thank you very much for your support. I went through the process step by step and I think I identified the problem, or at least something that isn’t right in our configuration. I identified that the mapping for the volume “/opt/sonarqube/data” is not mapped to the correct external volume. I will adjust these settings and try the upgrade again.

Host/volume Path in container
2873d508442ab7a8cd05a55e4d432b0fdb318e2b98c676afb7d2ca6dfdb25c68 /opt/sonarqube/extensions
10c99801b9d582f85717868daca365ba590776c45f01c57f0c24e1c8a4117177 /opt/sonarqube/logs
fdeb9d2212c38c4156a791cad4a7a657a299d66fcc98c46549c67fa4c78f0d9e /opt/sonarqube/temp
embrapadevops_sonardata /opt/sonarqube
f29b2487850b33c3b65990f8d63851b3f6d9760619a3e7a8c2fbb6531a131f3d /opt/sonarqube/data

Hello Colin,

Following up after fixing the volumes, unfortunately the problem persists. Even after updating the container version and accessing the setup screen, it still shows as version 10.7.0.

Volumes:

Container details:

Sonar app not upgraded:

sudo docker ps -f name=sonar
CONTAINER ID   IMAGE                               COMMAND                  CREATED          STATUS          PORTS                                         NAMES
67489cc9bc9f   sonarqube:25.3.0.104237-community   "/opt/sonarqube/dock…"   15 minutes ago   Up 15 minutes   0.0.0.0:9451->9000/tcp, [::]:9451->9000/tcp   sonarqube-embrapadevops

Thanks for the update.

Re-reviewing your compose file, I’m somewhat suspicious of this.

If you persist the entire installation directory between container restarts, then… nothing will get installed.

You’ll see in our example that only 4 directories are persisted.

    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
      - sonarqube_temp:/opt/sonarqube/temp

Can I suggest you revisit your compose file and stop persisting the entire install directory?

In any case, all SonarQube data is stored in the database. You do not risk losing any data.

Hi Colin,

Thank you very much for your help. You nailed the problem. After removing the wrong volume mapping the update went smoothly.

My best regards

1 Like

Sorry I didn’t notice it sooner! Glad you were able to upgrade. :sonar:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.