Operations 7 min read

One‑Click Jenkins + Docker + SpringBoot Automated Deployment Guide

This tutorial walks through setting up a CentOS 7 environment, installing Docker CE, deploying Jenkins in a Docker container, configuring Maven and required plugins, creating a Jenkins pipeline that builds a SpringBoot project, packages it into a Docker image via a Dockerfile, and runs the container automatically, providing full end‑to‑end CI/CD automation.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
One‑Click Jenkins + Docker + SpringBoot Automated Deployment Guide

The article describes a complete, step‑by‑step process for achieving one‑click automated deployment of a SpringBoot application using Jenkins, Docker, and Maven on a CentOS 7 host.

Environment

CentOS 7 with Git (Gitee) is used as the base system.

Install Docker

yum update
yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce   # install the latest stable version
systemctl start docker
systemctl enable docker
docker version   # verify installation

Install Jenkins

Run Jenkins in a Docker container:

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

Access Jenkins at http://{host‑ip}:8080, unlock it using the password from cat /var/lib/jenkins/secrets/initialAdminPassword, install the recommended plugins, and create an admin user.

System Configuration

Install required plugins such as Maven Integration, Publish Over SSH, and Gitee (if needed). Configure Maven under Manage Jenkins → Global Tool Configuration .

Create a Job

Create a new freestyle project, configure Git source code management with the repository URL and credentials, and add a build step that runs Maven: clean install -Dmaven.test.skip=true Save the job.

Testing the Build

Trigger a build, monitor the console output, and ensure the JAR is produced.

Dockerfile for the SpringBoot App

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

Jenkins Job Configuration for Docker

After the Maven build, add shell steps to build and run the Docker image:

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

Save the configuration.

Final Build and Verification

Run the Jenkins job, then verify the container is running with docker ps and view logs via docker logs {container‑name}. Access the application in a browser at http://{host‑ip}:8888 to confirm successful deployment.

The guide concludes with a call to share the article and join the community for further architectural discussions.

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/cdautomationmavenLinuxSpringBootJenkins
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

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.