Operations 9 min read

One-Click Jenkins + Docker + Spring Boot Deployment: Step-by-Step Guide

This guide walks through setting up a one‑click automated deployment pipeline for a Spring Boot application using Docker and Jenkins on CentOS 7, covering Docker installation, Jenkins container setup, required plugins, job configuration, building, testing, and running the project.

Programmer DD
Programmer DD
Programmer DD
One-Click Jenkins + Docker + Spring Boot Deployment: Step-by-Step Guide

This article provides a complete, beginner‑friendly tutorial for creating a one‑click automated deployment pipeline that combines Jenkins, Docker, and a Spring Boot project.

1. Install Docker

1. Ensure yum is up to date

yum update

2. Remove old Docker versions (if any)

yum remove docker docker-common docker-selinux docker-engine

3. Install required utilities

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

4. Add Docker repository

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

5. Install Docker CE

yum install docker-ce

6. Start Docker and enable on boot

systemctl start docker
systemctl enable docker

7. Verify installation

docker version

2. Install Jenkins

Run Jenkins inside a Docker container (make sure port 8080 is free):

docker run --name jenkins -u root --rm -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean

After a few minutes, access Jenkins at http://{server_ip}:8080.

2.1 Unlock Jenkins

# Enter the container
docker exec -it {Jenkins_container_name} bash
# View the initial admin password
cat /var/lib/jenkins/secrets/initialAdminPassword

2.2 Install recommended plugins

Select “Install recommended plugins” during the setup wizard.

2.3 Create admin user

Remember the administrator credentials you create.

3. System configuration

Install the following plugins (via Manage Jenkins → Manage Plugins):

Maven Integration

Publish Over SSH (optional)

Gitee (if using Gitee, Git is built‑in)

Configure Maven under “Manage Jenkins → Global Tool Configuration”.

4. Create a Jenkins job

4.1 New job

Create a “Freestyle project” and give it a name.

4.2 Source code management

Select Git, enter the repository URL, add credentials, and save.

4.3 Build trigger

Add a build step “Invoke top‑level Maven targets” with the goal:

clean install -Dmaven.test.skip=true

4.4 Save

Save the job configuration.

5. Test the pipeline

5.1 Build

Click “Build Now” and monitor the console output.

5.2 Verify artifact

After a successful build, the generated JAR appears in the workspace.

6. Run the project

6.1 Dockerfile

FROM jdk:8
VOLUME /tmp
ADD target/zx-order-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8888
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar","--spring.profiles.active=prd"]

6.2 Jenkins job steps for building the image and running the container

cd /var/jenkins_home/workspace/zx-order-api
docker stop zx-order || true
docker rm zx-order || true
docker rmi zx-order || true
docker build -t zx-order .
docker run -d -p 8888:8888 --name zx-order zx-order:latest

Check the container with docker ps and view logs via docker logs. Access the application at http://{server_ip}:8888.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Dockerci/cdautomationDevOpsSpring BootJenkins
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.