version: '2'

services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: sonar
      POSTGRES_USER: sonar
      POSTGRES_DB: sonar
    volumes:
      - pgdata:/var/lib/postgresql
  sonarqube:
    image: sonarqube
    restart: always
    environment:
      SONARQUBE_JDBC_USERNAME: sonar
      SONARQUBE_JDBC_PASSWORD: sonar
      SONARQUBE_JDBC_URL: jdbc:postgresql://db/sonar
    ports:
      - '9000:9000'
      - '9092:9092'
    command: -Dsonar.updatecenter.activate=false

volumes:
  pgdata: