Bootstrap

docker部署sonarqube

目录

一、准备 docker-compose.yml 文件

二、启动容器

三、查看容器状态

四、登录sonarqube


一、准备 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"
;