The Qiita article presents two ways to deploy SonarQube with Docker Compose: a trial setup using its embedded database and a deployment using PostgreSQL.
Prerequisites
Install Docker and Docker Compose.
Trial setup with the embedded database
SonarQube includes an H2 database for evaluation, so no separate database container is needed. Without persistent volumes, deleting the container also deletes its data; use this setup for trials.
Create compose.yml:
| |
Start the service from that directory:
| |
Open http://localhost:9000 and confirm the login page appears. The default credentials are admin / admin; change the password after signing in.

Setup with PostgreSQL
For a persistent deployment, run SonarQube and PostgreSQL in separate containers:
| |
The JDBC username, password, and URL in SonarQube must match the PostgreSQL settings. Docker Compose lets containers communicate through service names. Configure volumes for both services to persist their data.
| |
Then open http://localhost:9000 and wait for SonarQube to connect to PostgreSQL and finish initialization.
Summary
The embedded database is useful for a quick trial; PostgreSQL is suitable when data must persist. For actual operation, pin image versions and manage database credentials appropriately.