Foreword
There are many jenkins environment building method herein, this use to quickly build a docker jenkins environment.
Preparing the environment:
- linux server
- docker
docker run jenkins
Download jenkins first image https://hub.docker.com/r/jenkins/jenkins/tags , select jenkins latest version of lts.
jenkins version is too low, a lot of plug-in is not installed, the upgrade is also very troublesome.
docker pull jenkins/jenkins:lts
New jenkins user's working directory, pay attention to this step is the best directory consistent.
mkdir /home/jenkins
View directory attributable ID command ls -nd / home / jenkins, here ID 1000
[root@VM_0_2_centos home]# ls -nd /home/jenkins
drwxr-xr-x 2 1000 1000 4096 Dec 29 15:58 /home/jenkins
Add operating authority to the user ID 1000
chown -R 1000:1000 /home/jenkins
Run container
docker run -itd -p 9090:8080 -p 50000:50000 --name jenkins --privileged=true -v /home/jenkins:/var/jenkins_home jenkins/jenkins:lts
- --privileged = true so that the container have root access, easy access to container operations
- -p 9090: 8080 jenkins web access port 9090
- -v / home / jenkins: / var / jenkins_home container / var / jenkins_home path mapped to the host / home / jenkins
Browser and enter http://ip:9090/
access jenkins Home
Start jenkins
Start page password
PWL: / var / jenkins_home / secrets / initialAdminPassword
above startup container of / var / jenkins_home path mapped to the host / home / jenkins, the password can be found in the host / home / jenkins / secrets / initialAdminPassword address
[root@VM_0_2_centos ~]# cat /home/jenkins/secrets/initialAdminPassword
a1f6ceaa9c554d40a729158429faa36e
Next, enter the page to download the plug
Download plugin
The recommended installation option on the left side of the plug-in is automatically installed on it