Sonarqube on Docker

Hi! I’m not sure if I’m in the right topic:

I have installed Sonarqube on docker using the offical repo: https://hub.docker.com/_/sonarqube

Either way, I am looking to change the database from the default one to one that I already have installed (mariadb on Centos in vmware machine), that’s outside docker:
I enter the command line and I just noticed that I don’t have ssh, vim, ifconfig, etc.
I know it’s a cropped version of a debian installation, but how do I install everything? How do I root this computer: I didn’t find that info.

Thanks everyone in advance.

Regards,
maniat1k

What computer? A docker container is not a vm . A good image has the bare minimum dependencies required to provide it’s main service. By no means it includes a full fledged os…

The documentation of the image covers jdbc database connections. I am quite certain that the official sonarqube documentention (of the product, not the image) will provide a list of supported databases and an example jdbc connection string to configure the connection.

I would recommend the following before you start:

  • export your database and migrate to postgress so you can use the latest Sonarqube.
  • make sure you have an NFS (could be backed by gluster) to store your data.
  • Set up Traefik proxy

Once you have that infrastructure then create a docker-compose.yml file and do a stack deploy

version: "3.7"
services:
  sonarqube:
    image: sonarqube:7.7-community
    networks:
      - traefik
      - ljbackend
    environment:
      - sonar.jdbc.url=jdbc:XXXXXXX
      - "sonar.jdbc.username=sonar"
      - "sonar.jdbc.password=XXXXXXXXXXX"
    volumes:
      - /nfs/sonarqube-conf:/opt/sonarqube/conf
      - /nfs/sonarqube-data:/opt/sonarqube/data
      - /nfs/sonarqube-extensions:/opt/sonarqube/extensions
    deploy:
      replicas: 1
      restart_policy:
        condition: any
        delay: 10s
      resources:
        limits:
          memory: 2.5G
      labels:
        - "traefik.frontend.rule=Host:sonar.trajano.net"
        - "traefik.frontend.entryPoints=https"
        - "traefik.port=9000"
        - "traefik.enable=true"
        - "traefik.docker.network=traefik"

(note above is still traefik 1.7)

Docker containers running on the same host – one container will be for Jenkins and the other for SonarQube. The Jenkins container will also have sonar-scanner running locally to perform the code quality inspections.