Spring Boot, Jenkins and Docker – Part Three

Following on from the second post in the series, this article will describe basic steps for configuring the first pass at our Jenkins pipeline.

1) frontend Build job creation

If you have followed the second post, Jenkins should now be up and running and accessible by going to (or whatever IP your Docker host is running on).

You should see a screen that resembles figure 1 below.

Image of Jenkins started up
Figure 1 – Image of Jenkins started up

Click on ‘New Item‘, a new screen will load.

Enter ‘spring-boot-frontend‘ for the ‘Item name

Ensure ‘Maven project‘ is selected

Click ‘OK

On the resulting screen under ‘Source code management‘, choose ‘Git

Enter ‘https://github.com/eggsy84/spring-boot-frontend.git‘ in to the ‘Repository URL‘ field. (You can of course change this to your SCM location)

Scroll down to the ‘Build triggers‘ section

Choose ‘Poll SCM‘ and enter ‘* * * * *‘ in to the schedule field (This means poll every minute)

Scroll down to the ‘Build‘ section

Enter ‘clean compile -DskipTests=true‘ in to the ‘Goals and options‘ field

Scroll down and click ‘Save

After clicking Save you will be returned to the job dashboard. A build job should automatically trigger as shown in figure 2.

Jenkins job auto triggered
Figure 2 – Job execution

That job will take a number of minutes to complete whilst it downloads the  various Maven dependencies. You can click in to the job and choose ‘Console’ to monitor the progress.

Once complete the console should look similar to figure 3 below.

Jenkins job success
Figure 3 – Job success

Congratulations, you just created your first Maven based Jenkins job!

Spring Boot, Jenkins and Docker – Part Two

Following on from the first post in the series, this article will describe how to get Jenkins up and running (as a container) in Docker and the installation of a few plugins that will be useful for the pipeline.

1) Docker installation

Docker provide comprehensive installation instructions on their site. Please follow their instructions and move on to step 2.

Mac instructions
Windows instructions
Linux instructions

2) Jenkins image

Once you have successfully installed, we can also use Docker to quickly (and easily) get a Jenkins instance up and running.

The next stage is to enter the docker console. On Mac this is as easy as launching the Docker QuickStart Terminal application from the launcher. Shown in figure 1 below.

Docker Quickstart Terminal
Docker Quickstart Terminal

Once in the console, firstly take note of the Virtual Machine IP address.

A message similar to ‘docker is configured to use the default machine with IP‘ will be shown.

The remainder of the blog posts will assume that your virtual machine is running on

Now you can pull the Jenkins image:

# docker pull eggsy84/jenkins-maven-git-docker

This will pull down a pre-configured Jenkins image that I have created for this series of posts. The image has Jenkins and Maven both installed. It also installs various Jenkins plugins we shall make use of during the tutorial:

  • git
  • build pipeline
  • Cloudbees docker build and publish

As well as installing Jenkins it will also configure jenkins with the locations of Maven and Docker. For those interested in the Dockerfile it is on my public github account.

It should complete and produce a message similar to:

Digest: sha256:d58a96de4fe25806b561baf3b869e80f0c3cde854aebb090cad8ff56f3114928
Status: Downloaded newer image for eggsy84/jenkins-maven-git-docker:latest

We can then run ‘docker images’ to verify the image is present

# docker images

eggsy84/jenkins-maven-git-docker latest e27897648e2c 2 hours ago 743.9 MB

3) Starting Jenkins

Once the image download has completed we can start up an instance of Jenkins.

# docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/bin/docker -p 8080:8080 -t eggsy84/jenkins-maven-git-docker:latest

You should see output identifying that Jenkins has started up.

Also note that we have started Jenkins and bounded the docker executable from the host in to the container. This allows us to execute docker commands within the container. Thanks to @jpetazzo for his blog post on that

Open up a browser and navigate to

Part 3 – Jenkins job creation