Cloud Native 3 min read

How to Install Jenkins on CentOS 7 Using Docker

This guide walks through installing Docker on CentOS 7, pulling the official Jenkins image, creating a host volume, running the container with proper port and volume mappings, retrieving the initial admin password, and completing the Jenkins setup with recommended plugins.

The Dominant Programmer
The Dominant Programmer
The Dominant Programmer
How to Install Jenkins on CentOS 7 Using Docker

Install Jenkins via Docker on CentOS 7

Search the Jenkins image:

docker search jenkins

Pull the image and verify it was downloaded:

docker pull jenkins/jenkins
docker images

Create a host directory for Jenkins data and grant full permissions:

mkdir /jenkinshome
chmod 777 -R /jenkinshome/

Run the Jenkins container in detached mode, mapping host port 8088 to container port 8080 and mounting the data volume:

docker run -d --name jenkins -p 8088:8080 -v /jenkinshome:/var/jenkins_home jenkins/jenkins:latest
-d

: run in background --name: container name -p: host:container port mapping -v: host directory to container directory volume mount

Access Jenkins from a browser at http://HOST_IP:8088. Ensure the host firewall allows port 8088. The UI prompts for the initial admin password.

Retrieve the password by entering the container and reading the secret file:

docker exec -it jenkins /bin/bash
cat /var/jenkins_home/secrets/initialAdminPassword

Copy the displayed password and paste it into the Jenkins setup page.

After unlocking, install the recommended plugins, then create an administrator user and password.

Complete the configuration; Jenkins is ready for creating jobs and pipelines.

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/CDcontainerInstallationJenkinscentos7
The Dominant Programmer
Written by

The Dominant Programmer

Resources and tutorials for programmers' advanced learning journey. Advanced tracks in Java, Python, and C#. Blog: https://blog.csdn.net/badao_liumang_qizhi

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.