Install Sonarqube LTS Community with Docker Compose

Berikut install Sonarqube menggunakan Docker Compose, untuk data akan mounting ke tempat lain.

File docker-compose.yaml

version: "3"
services:
  sonarqube:
    image: sonarqube:lts-community
    container_name: sonarqube
    hostname: sonarqube
    depends_on:
      - db
    environment:
      - sonar.jdbc.url=jdbc:postgresql://db:5432/sonar
      - sonar.jdbc.username=admin
      - sonar.jdbc.password=lalalala
      - sonar.search.javaAdditionalOpts=-Dbootstrap.system_call_filter=false
    volumes:
      - /mnt/sonar/new/sonarqube/data:/opt/sonarqube/data
      - /mnt/sonar/new/sonarqube/extensions:/opt/sonarqube/extensions
      - /mnt/sonar/new/sonarqube/logs:/opt/sonarqube/logs
    ports:
      - "80:9000"
  db:
    image: postgres:12
    container_name: db
    hostname: db
    environment:
      - POSTGRES_USER=admin
      - POSTGRES_PASSWORD=lalalala
      - POSTGRES_DB=sonar
    volumes:
      - /mnt/sonar/new/postgres/postgres:/var/lib/postgresql
      - /mnt/sonar/new/postgres/postgres_data:/var/lib/postgresql/data
volumes:
  data:
  extensions:
  logs:
  postgres:
  postgres_data:

Running docker-compose

docker-compose up -d

Akses sonarqube http://localhost

Cek log

docker logs sonarqube

Sekian