Sonarqube篇-Docker安装sonarqube 7.8

1 centos7安装docker-ce docker-compose

1.1 安装docker-ce

1.1.1 安装依赖

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

1.1.2 添加docker下载仓库

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

1.1.3 安装docker-ce

sudo yum install docker-ce

1.1.4 启动docker-ce

sudo systemctl start docker
sudo systemctl enable docker

1.1.5 验证

sudo docker --version

1.2 安装docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version

2 编辑docker-compose.yml并部署

  • vim docker-compose.yml
version: "3"

services:
sonarqube:
image: sonarqube:7.8-community
ports:
- "9000: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:11.1
networks:
- sonarnet
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- postgresql_data:/var/lib/postgresql/data

networks:
sonarnet:
driver: bridge

volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_bundled-plugins:
postgresql_data:

  • docker-compose up -d

3 查看容器状态并校错

1)错误1:vm.max_map_count 参数值为65530,太小
Sonarqube篇-Docker安装sonarqube 7.8_第1张图片

vim /etc/sysctl.d/99-sysctl.conf

vm.max_map_count=262144

docker start [容器名称]

在这里插入图片描述
2)登录 IP:9000 admin/admin
Sonarqube篇-Docker安装sonarqube 7.8_第2张图片

你可能感兴趣的:(自动化运维,docker安装sonar,安装sonarqube)