Jenkins Nexus SonarQube Docker-Compose: Build The DevOps environment – Cool 4 Components!

You are currently viewing Jenkins Nexus SonarQube Docker-Compose: Build The DevOps environment – Cool 4 Components!
Share this post and Earn Free Points!

This is another my post in which I present how to build DevOps" env (Jenkins Nexus SonarQube Docker-Compose") in a simple way how to set up the environment using the benefits of Docker-Compose".


Jenkins Nexus SonarQube Docker-Compose

This time we will focus on an example where we will configure an environment consisting of:


The leading open" source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.

Jenkins" is an open-source automation server that is commonly used in DevOps" environments to automate the build, test, and deployment of software. It is designed to be highly extensible and provides a wide range of plugins that can be used to integrate with various tools and services.

In a DevOps" environment, Jenkins" is often used to automate the software delivery pipeline, enabling teams to build, test, and deploy software more quickly and efficiently. It can be used to automate tasks such as building and testing code, running static analysis tools, and deploying code to various environments.

Jenkins" is typically used in conjunction with other tools and services, such as version control systems (e.g. Git), continuous integration tools (e.g. Maven"), and containerization platforms (e.g. Docker"). It can be integrated with these tools using plugins or by using APIs or command-line tools.

Overall, Jenkins is a powerful tool that is widely used in DevOps environments to automate the software delivery process and improve the efficiency of software development teams".

SonarQube + PostgreSQL

SonarQube" is an automatic code review tool to detect bugs, vulnerabilities, and code smells in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.

PostgreSQL is a powerful, open" source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. –


The free artifact repository with universal format support. Single source of truth for all of your components, binaries, and build artifacts. Efficiently distribute parts and containers to developers. Deployed at more than 100,000 organisations globally.

Build DevOps Environment

In the following steps we will build the DevOps" envronment using Docker-Compose".

Create Docker-Compose.yml File

version: "3"
    image: jenkinsci/blueocean
    container_name: jenkins
      - DOCKER_HOST=tcp://localhost:2375
      - JENKINS_UC=
    user: root
      - "8080:8080"
      - "8443:8443"
      - "50000:50000"  
      - "8080"
      - jenkins-data:/var/jenkins_home
      - jenkins-home:/home

    image: sonatype/nexus3
    container_name: nexus
      - "nexus-data:/nexus-data"
      - "8081:8081"
      - "8081"

    image: sonarqube
    container_name: sonarqube
      - "9000:9000"
      - sonar.jdbc.url=jdbc:postgresql://db:5432/sonar
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions

    image: postgres
      - POSTGRES_USER=sonar
      - postgresql:/var/lib/postgresql
      # This needs explicit mapping due to
      - postgresql_data:/var/lib/postgresql/data

  nexus-data: {}
  jenkins-data: {}
  jenkins-home: {}
  sonarqube_conf: {}
  sonarqube_data: {}
  sonarqube_extensions: {}
  postgresql: {}
  postgresql_data: {}

Check Container Status

Before we start the further part of the configuration, check that all containers are in “UP” status.

docker-compose ps
          Name                        Command               State                                    Ports                                  
jenkins                    /sbin/tini -- /usr/local/b ...   Up>50000/tcp,>8080/tcp,>8443/tcp
jenkins_nexus_sonar_db_1 postgres    Up      5432/tcp                                                                
nexus                      sh -c ${SONATYPE_DIR}/star ...   Up>8081/tcp                                                  
sonarqube                  ./bin/                     Up>9000/tcp 

Jenkins – First Run

The Jenkins" user" interface is available at: http://localhost:8080

At the first start we will be asked to enter the administrator password, which is saved in the file: /var/jenkins_home/secrets/initialAdminPassword, which is located on the container file system with Jenkins". To open" the contents of this file we must “enter” this container using SSH. To do this, run the following command from the terminal:

# docker exec -it <docker_container_name>  /bin/bash
docker exec -it jenkins /bin/bash

Once inside the container, run the command below. The string is our administrator password.

cat /var/jenkins_home/secrets/initialAdminPassword

Plugins Installation

Następnie zainstaluj sugerowane wtyczki. Jest to zbiór podstawowych rozszerzeń, które można traktować jako pakiet startowy.

And than:

Creating an Administrator Account

The next step is to create an administrator account".

After creating the admin account", we can fully use Jenkins".

Nexus – First Run

The Nexus" user" interface is available at: http://localhost:8081

When you try to log in for the first time, we will receive information that the admin user" password has been generated and is located under the path: /nexus-data/admin.password. Let’s check the password!

Using the command below we will enter to the Nexus" container.

docker exec -it nexus /bin/bash

cat /nexus-data/admin.password

We paste the above password into the login" form. Then we will be asked to set your password, which I encourage.

SonarQube – First Run

The SonarQube" user" interface is available at: http://localhost:9000

Click the “Log-in” button in the upper right corner. The default" administrator user" is admin and the password is also admin.


As you can see, creating an environment with Docker-Compose" is really easy. In a few minutes we can create and start using tools.

To sum up, below is a list of URLs to: Jenkins", Nexus" and SonarQube".

Could You Please Share This Post? 
I appreciate It And Thank YOU! :)
Have A Nice Day!

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 1331

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?