Operations 6 min read

One‑Click Automated Deployment of Spring Boot with Jenkins and Docker

This tutorial walks through a complete, step‑by‑step setup of a one‑click CI/CD pipeline that installs Docker and Jenkins on CentOS, configures Maven, creates a Jenkins job, builds a Spring Boot JAR, packages it into a Docker image, and runs the container, providing all commands and screenshots for a seamless deployment experience.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
One‑Click Automated Deployment of Spring Boot with Jenkins and Docker

This article provides a step‑by‑step guide to set up a one‑click automated deployment pipeline for a Spring Boot application using Docker and Jenkins on a CentOS 7 host.

Environment : CentOS 7 with Git (Gitee). The process includes installing Docker, installing Jenkins, configuring system plugins, creating a Jenkins job, testing, and running the application.

Install Docker – update yum, remove old versions, install required packages, add Docker repository, install Docker CE, start and enable the service, and verify with docker version.

Install Jenkins – run a Jenkins container, access http://{host_ip}:8080, unlock Jenkins by retrieving the initial admin password with cat /var/lib/jenkins/secrets/initialAdminPassword, install the recommended plugins, and create an admin user.

System configuration – install Maven Integration, Publish Over SSH, and Gitee plugins; configure Maven installation under “Global Tool Configuration”.

Create job – create a freestyle project, set the Git repository URL and credentials, add a Maven build step with goal clean install -Dmaven.test.skip=true, and save.

Test – trigger a build, view console output, and verify that a JAR is produced; check the workspace at /var/jenkins_home/workspace.

Run project – write a Dockerfile that uses JDK 8, copies the built JAR, exposes port 8888, and defines the entrypoint. In the Jenkins job add shell steps to stop/remove old containers, build the image with docker build -t zx-order ., and run it with docker run -d -p 8888:8888 --name zx-order zx-order:latest.

After the build finishes, verify the container is running with docker ps and access the application via http://{host_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.

ci/cdAutomationmavenSpring BootJenkinsCentOS
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

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.