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.
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
