目录
一、准备 docker-compose.yml 文件
挂载路径和端口根据实际情况修改
version: "3"
services:
sonarqube:
image: sonarqube:lts-community
depends_on:
- db
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
volumes:
- /root/docker/sonarqube/sonarqube_data:/opt/sonarqube/data
- /root/docker/sonarqube/sonarqube_extensions:/opt/sonarqube/extensions
- /root/docker/sonarqube/sonarqube_logs:/opt/sonarqube/logs
ports:
- "9000:9000"
db:
image: postgres:12
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar
volumes:
- /root/docker/sonarqube/postgresql:/var/lib/postgresql
- /root/docker/sonarqube/postgresql_data:/var/lib/postgresql/data
ports:
- "5432:5432"