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: sonar
POSTGRES_DB: sonar
sonar:
image: sonarqube:7.9-community
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: sonar
SONARQUBE_JDBC_URL: jdbc:postgresql://postgres:5432/sonar
问题
- es启动不起来
解决:使用chmod命令给日志目录读写权限
- 日志文件产生错误
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:elasticsearch 分配内存的配置问题,在宿主机执行:sysctl -w vm.max_map_count=262144