docker部署sonar

2022-10-27 15:13:10 浏览数 (1)

编写docker-compose文件

代码语言:javascript复制
version: "3"
services:
  sonar:
    image: sonarqube:8.4.2-community
    container_name: sonar
    hostname: sonar
    restart: always
    depends_on:
      - pgsql
    ports:
      - 9000:9000
    environment:
      - SONAR_JDBC_URL=jdbc:postgresql://pgsql:5432/sonarqube?
      - SONAR_JDBC_USERNAME=postgres
      - SONAR_JDBC_PASSWORD=123456
    volumes:
      - /data/sonarqube/sonarqube_extensions:/opt/sonarqube/extensions
      - /data/sonarqube/sonarqube_logs:/opt/sonarqube/logs
      - /data/sonarqube/sonarqube_data:/opt/sonarqube/data
 
  pgsql:
    image: postgres:12
    container_name: pgsql
    hostname: pgsql
    restart: always
    volumes:
      - /data/pgsql/data:/var/lib/postgresql/data
    environment:
      TZ: Asia/Shanghai
      POSTGRES_PASSWORD: 123456
      POSTGRES_DB: sonarqube
    ports:
      - "5432:5432"
    logging:
      options:
        max-size: '100m'
        max-file: '10'

启动

代码语言:javascript复制
docker-compose up -d

登录

默认用户名和密码:admin/admin

安装中文包

0 人点赞