One-Click Automated Deployment of Spring Boot with Jenkins and Docker
This guide walks through setting up Docker and Jenkins on CentOS, configuring a Spring Boot project, creating a Jenkins pipeline, and automating build, test, and deployment steps to achieve one‑click continuous integration and delivery.
This article provides a step‑by‑step tutorial for building a complete CI/CD pipeline that automatically builds, packages, and deploys a Spring Boot application using Docker and Jenkins.
1. Install Docker
Prepare the CentOS host, update packages, remove any old Docker versions, install required utilities, add the Docker CE repository, and 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 systemctl start docker systemctl enable docker docker version2. Install Jenkins
Run Jenkins in a Docker container, then access the web UI on port 8080. Unlock Jenkins by retrieving the initial admin password from the 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/blueoceanObtain the password:
docker exec -it jenkins bash
cat /var/lib/jenkins/secrets/initialAdminPassword3. System Configuration
Install required plugins such as Maven Integration and Publish Over SSH. Configure Maven in Manage Jenkins → Global Tool Configuration and set the Maven installation path.
4. Create Job
Create a freestyle job, add the Git repository, and define a build step that invokes Maven to package the project and then builds a 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:latest5. Test and Run
Trigger the build, monitor the console output, and verify the container is running with docker ps. Access the application via http://{host_ip}:8888 to confirm successful deployment.
docker ps docker logs zx-orderAfter verification, the Spring Boot service is continuously delivered with a single click.
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.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
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.
