version: '2'
services:
    sonar:
        container_name: sonarqube
        image: sonarqube:6.1-alpine
        environment:
            - SONARQUBE_JDBC_USERNAME=sonar
            - SONARQUBE_JDBC_PASSWORD=sonar
            - SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube-postgresql:5432/sonar
        ports:
            - 9000:9000
            - 9092:9092
    sonarqube-postgresql:
        container_name: sonarqube-postgresql
        image: postgres:9.5.4
        volumes:
            - ~/volumes/sonarqube/postgresql/:/var/lib/postgresql/data
        environment:
            - POSTGRES_USER=sonar
            - POSTGRES_PASSWORD=sonar
            - POSTGRES_DB=sonar
        ports:
            - 5432

Add compose files for SonarQube, using PostgreSQL as database
Add compose files for SonarQube, using PostgreSQL as database
