废话不多说上代码
version: '3'
services:
postgres:
image: postgres:12
restart: always
container_name: postgres
ports:
- 5432:5432
volumes:
- /opt/postgres/postgresql/:/var/lib/postgresql
- /opt/postgres/data/:/var/lib/postgresql/data
environment:
TZ: Asia/Shanghai
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar123
POSTGRES_DB: sonar
networks:
- sonar-network
sonar:
image: sonarqube:8.2-community
restart: always
container_name: sonar
depends_on:
- postgres
volumes:
- /opt/sonarqube/extensions:/opt/sonarqube/extensions
- /opt/sonarqube/logs:/opt/sonarqube/logs
- /opt/sonarqube/data:/opt/sonarqube/data
- /opt/sonarqube/conf:/opt/sonarqube/conf
ports:
- 9000:9000
environment:
SONARQUBE_JDBC_USERNAME: sonar
SONARQUBE_JDBC_PASSWORD: sonar123
SONARQUBE_JDBC_URL: jdbc:postgresql://postgres:5432/sonar
networks:
- sonar-network
networks:
sonar-network:
driver: bridge
参考链接
来源:CSDN
作者:落墨微澜
链接:https://blog.csdn.net/qq_35868811/article/details/104790459