Docker部署SonarQube

时间:2024-12-18 08:07:49

依赖

  • CentOS 7.2+
  • docker 1.13+
  • docker-compose 1.20+

将下面文件内容另存为docker-compose.yml文件,执行docker-compose up -d进行启动服务

version: "2"

services:
sonarqube:
image: sonarqube
ports:
- "80:9000"
networks:
- sonarnet
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
volumes:
- sonarqube_conf:/opt/sonarqube/conf
- sonarqube_data:/opt/sonarqube/data
- sonarqube_extensions:/opt/sonarqube/extensions
- sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins db:
image: postgres
networks:
- sonarnet
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- postgresql:/var/lib/postgresql
- postgresql_data:/var/lib/postgresql/data networks:
sonarnet:
driver: bridge volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_bundled-plugins:
postgresql:
postgresql_data:

之后的过程和二进制包安装无任何区别