Awesome, let's gooo! 🚀 Here's how you can create a **custom SonarQube Docker image** using a `Dockerfile`. ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 🛠 1. **Create a Project Directory** ```bash mkdir custom-sonarqube cd custom-sonarqube ``` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 📄 2. **Create a `Dockerfile`** ```Dockerfile # Use the official SonarQube base image FROM sonarqube:community # Maintainer (optional) LABEL maintainer="infocusm21@gmail.com" # Optional: Copy custom configuration # COPY sonar.properties /opt/sonarqube/conf/sonar.properties # Optional: Copy custom plugins # COPY ./plugins/*.jar /opt/sonarqube/extensions/plugins/ # Expose the default SonarQube port EXPOSE 9000 # The base image's CMD is already configured properly, so no need to override ``` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### ⚙️ 3. (Optional) Add Custom Config or Plugins You can customize further: #### 🔧 sonar.properties (Optional Config File) If you want to override settings like DB config, web port, etc.: ```bash # sonar.properties (example) sonar.web.port=9000 sonar.security.realm=LDAP ``` Then uncomment this line in your Dockerfile: ```Dockerfile COPY sonar.properties /opt/sonarqube/conf/sonar.properties ``` #### 🔌 Add Plugins If you have additional plugins (`.jar` files): ```bash mkdir plugins # Place .jar plugin files inside ./plugins/ ``` Then use: ```Dockerfile COPY ./plugins/*.jar /opt/sonarqube/extensions/plugins/ ``` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 🧱 4. **Build the Image** ```bash docker build -t my-custom-sonarqube . ``` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 🚀 5. **Run the Container** ```bash docker run -d -p 9000:9000 --name sonarqube sonarqube:latest ``` Visit: 📍 `http://localhost:9000` Default login is: - **Username**: `admin` - **Password**: `admin` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 💾 (Optional) Persist Data Using Volumes ```bash docker run -d -p 9000:9000 \ -v sonarqube_data:/opt/sonarqube/data \ -v sonarqube_extensions:/opt/sonarqube/extensions \ --name sonarqube-container my-custom-sonarqube ``` ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ ### 🧩 Want SonarQube + PostgreSQL with Docker Compose? Let me know — I can show you a full `docker-compose.yml` setup with DB integration and environment variables ready to go. Want that next?